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 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 @staticmethod | 840 @staticmethod |
841 def LoadCurrentConfig(options): | 841 def LoadCurrentConfig(options): |
842 """Searches for and loads a .gclient file relative to the current working | 842 """Searches for and loads a .gclient file relative to the current working |
843 dir. Returns a GClient object.""" | 843 dir. Returns a GClient object.""" |
844 path = gclient_utils.FindGclientRoot(os.getcwd(), options.config_filename) | 844 path = gclient_utils.FindGclientRoot(os.getcwd(), options.config_filename) |
845 if not path: | 845 if not path: |
846 return None | 846 return None |
847 client = GClient(path, options) | 847 client = GClient(path, options) |
848 client.SetConfig(gclient_utils.FileRead( | 848 client.SetConfig(gclient_utils.FileRead( |
849 os.path.join(path, options.config_filename))) | 849 os.path.join(path, options.config_filename))) |
| 850 |
| 851 if (options.revisions and |
| 852 len(client.dependencies) > 1 and |
| 853 any('@' not in r for r in options.revisions)): |
| 854 print >> sys.stderr, ( |
| 855 'You must specify the full solution name like --revision %s@%s\n' |
| 856 'when you have multiple solutions setup in your .gclient file.\n' |
| 857 'Other solutions present are: %s.') % ( |
| 858 client.dependencies[0].name, |
| 859 options.revisions[0], |
| 860 ', '.join(s.name for s in client.dependencies[1:])) |
850 return client | 861 return client |
851 | 862 |
852 def SetDefaultConfig(self, solution_name, deps_file, solution_url, | 863 def SetDefaultConfig(self, solution_name, deps_file, solution_url, |
853 safesync_url, managed=True): | 864 safesync_url, managed=True): |
854 self.SetConfig(self.DEFAULT_CLIENT_FILE_TEXT % { | 865 self.SetConfig(self.DEFAULT_CLIENT_FILE_TEXT % { |
855 'solution_name': solution_name, | 866 'solution_name': solution_name, |
856 'solution_url': solution_url, | 867 'solution_url': solution_url, |
857 'deps_file': deps_file, | 868 'deps_file': deps_file, |
858 'safesync_url' : safesync_url, | 869 'safesync_url' : safesync_url, |
859 'managed': managed, | 870 'managed': managed, |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1493 except (gclient_utils.Error, subprocess2.CalledProcessError), e: | 1504 except (gclient_utils.Error, subprocess2.CalledProcessError), e: |
1494 print >> sys.stderr, 'Error: %s' % str(e) | 1505 print >> sys.stderr, 'Error: %s' % str(e) |
1495 return 1 | 1506 return 1 |
1496 | 1507 |
1497 | 1508 |
1498 if '__main__' == __name__: | 1509 if '__main__' == __name__: |
1499 fix_encoding.fix_encoding() | 1510 fix_encoding.fix_encoding() |
1500 sys.exit(Main(sys.argv[1:])) | 1511 sys.exit(Main(sys.argv[1:])) |
1501 | 1512 |
1502 # vim: ts=2:sw=2:tw=80:et: | 1513 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |