Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Meta checkout manager supporting both Subversion and GIT. | 6 """Meta checkout manager supporting both Subversion and GIT. |
| 7 | 7 |
| 8 Files | 8 Files |
| 9 .gclient : Current client configuration, written by 'config' command. | 9 .gclient : Current client configuration, written by 'config' command. |
| 10 Format is a Python script defining 'solutions', a list whose | 10 Format is a Python script defining 'solutions', a list whose |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 916 return revision_overrides | 916 return revision_overrides |
| 917 # Do not check safesync_url if one or more --revision flag is specified. | 917 # Do not check safesync_url if one or more --revision flag is specified. |
| 918 if not self._options.revisions: | 918 if not self._options.revisions: |
| 919 for s in self.dependencies: | 919 for s in self.dependencies: |
| 920 if not s.managed: | 920 if not s.managed: |
| 921 self._options.revisions.append('%s@unmanaged' % s.name) | 921 self._options.revisions.append('%s@unmanaged' % s.name) |
| 922 elif s.safesync_url: | 922 elif s.safesync_url: |
| 923 handle = urllib.urlopen(s.safesync_url) | 923 handle = urllib.urlopen(s.safesync_url) |
| 924 rev = handle.read().strip() | 924 rev = handle.read().strip() |
| 925 handle.close() | 925 handle.close() |
| 926 if len(rev): | 926 scm = gclient_scm.CreateSCM(s.url, s.root.root_dir, s.name) |
| 927 self._options.revisions.append('%s@%s' % (s.name, rev)) | 927 safe_rev = scm.GetUsableRev( |
| 928 cwd=scm.checkout_path, url=scm.url, rev=rev, | |
|
M-A Ruel
2011/11/09 19:25:51
Why pass scm.checkout_path and scm.url when you ar
Dan Beam
2011/11/09 19:36:52
I think you told me to make them @staticmethods, r
M-A Ruel
2011/11/09 19:38:50
Yes, but I told you that because you were precisel
Dan Beam
2011/11/10 10:29:15
Done.
| |
| 929 options=self._options) | |
| 930 if not safe_rev: | |
| 931 raise gclient_utils.Error( | |
| 932 'Despite our best attempts, we couldn\'t find a useful ' | |
| 933 'safesync_url revision for you.') | |
| 934 if self._options.verbose: | |
| 935 print('Using safesync_url revision: %s.\n' % safe_rev) | |
| 936 self._options.revisions.append('%s@%s' % (s.name, safe_rev)) | |
| 928 if not self._options.revisions: | 937 if not self._options.revisions: |
| 929 return revision_overrides | 938 return revision_overrides |
| 930 solutions_names = [s.name for s in self.dependencies] | 939 solutions_names = [s.name for s in self.dependencies] |
| 931 index = 0 | 940 index = 0 |
| 932 for revision in self._options.revisions: | 941 for revision in self._options.revisions: |
| 933 if not '@' in revision: | 942 if not '@' in revision: |
| 934 # Support for --revision 123 | 943 # Support for --revision 123 |
| 935 revision = '%s@%s' % (solutions_names[index], revision) | 944 revision = '%s@%s' % (solutions_names[index], revision) |
| 936 sol, rev = revision.split('@', 1) | 945 sol, rev = revision.split('@', 1) |
| 937 if not sol in solutions_names: | 946 if not sol in solutions_names: |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1517 except (gclient_utils.Error, subprocess2.CalledProcessError), e: | 1526 except (gclient_utils.Error, subprocess2.CalledProcessError), e: |
| 1518 print >> sys.stderr, 'Error: %s' % str(e) | 1527 print >> sys.stderr, 'Error: %s' % str(e) |
| 1519 return 1 | 1528 return 1 |
| 1520 | 1529 |
| 1521 | 1530 |
| 1522 if '__main__' == __name__: | 1531 if '__main__' == __name__: |
| 1523 fix_encoding.fix_encoding() | 1532 fix_encoding.fix_encoding() |
| 1524 sys.exit(Main(sys.argv[1:])) | 1533 sys.exit(Main(sys.argv[1:])) |
| 1525 | 1534 |
| 1526 # vim: ts=2:sw=2:tw=80:et: | 1535 # vim: ts=2:sw=2:tw=80:et: |
| OLD | NEW |