OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # | 2 # |
3 # Copyright 2008 Google Inc. All Rights Reserved. | 3 # Copyright 2008 Google Inc. All Rights Reserved. |
4 # | 4 # |
5 # Licensed under the Apache License, Version 2.0 (the "License"); | 5 # Licensed under the Apache License, Version 2.0 (the "License"); |
6 # you may not use this file except in compliance with the License. | 6 # you may not use this file except in compliance with the License. |
7 # You may obtain a copy of the License at | 7 # You may obtain a copy of the License at |
8 # | 8 # |
9 # http://www.apache.org/licenses/LICENSE-2.0 | 9 # http://www.apache.org/licenses/LICENSE-2.0 |
10 # | 10 # |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 solutions = self.GetVar("solutions") | 802 solutions = self.GetVar("solutions") |
803 if not solutions: | 803 if not solutions: |
804 raise gclient_utils.Error("No solution specified") | 804 raise gclient_utils.Error("No solution specified") |
805 | 805 |
806 entries = {} | 806 entries = {} |
807 entries_deps_content = {} | 807 entries_deps_content = {} |
808 | 808 |
809 # Inner helper to generate base url and rev tuple (including honoring | 809 # Inner helper to generate base url and rev tuple (including honoring |
810 # |revision_overrides|) | 810 # |revision_overrides|) |
811 def GetURLAndRev(name, original_url): | 811 def GetURLAndRev(name, original_url): |
812 if original_url.find("@") < 0: | 812 revision, url = gclient_utils.SplitUrlRevision(original_url) |
| 813 if not revision: |
813 if revision_overrides.has_key(name): | 814 if revision_overrides.has_key(name): |
814 return (original_url, revision_overrides[name]) | 815 return (url, revision_overrides[name]) |
815 else: | 816 else: |
816 scm = gclient_scm.CreateSCM(solution["url"], self._root_dir, name) | 817 scm = gclient_scm.CreateSCM(solution["url"], self._root_dir, name) |
817 return (original_url, scm.revinfo(self._options, [], None)) | 818 return (url, scm.revinfo(self._options, [], None)) |
818 else: | 819 else: |
819 url_components = original_url.split("@") | |
820 if revision_overrides.has_key(name): | 820 if revision_overrides.has_key(name): |
821 return (url_components[0], revision_overrides[name]) | 821 return (url, revision_overrides[name]) |
822 else: | 822 else: |
823 return (url_components[0], url_components[1]) | 823 return (url, revision) |
824 | 824 |
825 # Run on the base solutions first. | 825 # Run on the base solutions first. |
826 for solution in solutions: | 826 for solution in solutions: |
827 name = solution["name"] | 827 name = solution["name"] |
828 if name in entries: | 828 if name in entries: |
829 raise gclient_utils.Error("solution %s specified more than once" % name) | 829 raise gclient_utils.Error("solution %s specified more than once" % name) |
830 (url, rev) = GetURLAndRev(name, solution["url"]) | 830 (url, rev) = GetURLAndRev(name, solution["url"]) |
831 entries[name] = "%s@%s" % (url, rev) | 831 entries[name] = "%s@%s" % (url, rev) |
832 # TODO(aharper): SVN/SCMWrapper cleanup (non-local commandset) | 832 # TODO(aharper): SVN/SCMWrapper cleanup (non-local commandset) |
833 entries_deps_content[name] = gclient_scm.CaptureSVN( | 833 entries_deps_content[name] = gclient_scm.CaptureSVN( |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 | 1180 |
1181 if "__main__" == __name__: | 1181 if "__main__" == __name__: |
1182 try: | 1182 try: |
1183 result = Main(sys.argv) | 1183 result = Main(sys.argv) |
1184 except gclient_utils.Error, e: | 1184 except gclient_utils.Error, e: |
1185 print >> sys.stderr, "Error: %s" % str(e) | 1185 print >> sys.stderr, "Error: %s" % str(e) |
1186 result = 1 | 1186 result = 1 |
1187 sys.exit(result) | 1187 sys.exit(result) |
1188 | 1188 |
1189 # vim: ts=2:sw=2:tw=80:et: | 1189 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |