OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 # Files | 7 # Files |
8 # .gclient : Current client configuration, written by 'config' command. | 8 # .gclient : Current client configuration, written by 'config' command. |
9 # Format is a Python script defining 'solutions', a list whose | 9 # Format is a Python script defining 'solutions', a list whose |
10 # entries each are maps binding the strings "name" and "url" | 10 # entries each are maps binding the strings "name" and "url" |
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 self.config_content = None | 1045 self.config_content = None |
1046 | 1046 |
1047 def _CheckConfig(self): | 1047 def _CheckConfig(self): |
1048 """Verify that the config matches the state of the existing checked-out | 1048 """Verify that the config matches the state of the existing checked-out |
1049 solutions.""" | 1049 solutions.""" |
1050 for dep in self.dependencies: | 1050 for dep in self.dependencies: |
1051 if dep.managed and dep.url: | 1051 if dep.managed and dep.url: |
1052 scm = gclient_scm.CreateSCM(dep.url, self.root_dir, dep.name) | 1052 scm = gclient_scm.CreateSCM(dep.url, self.root_dir, dep.name) |
1053 actual_url = scm.GetActualRemoteURL() | 1053 actual_url = scm.GetActualRemoteURL() |
1054 if actual_url and not scm.DoesRemoteURLMatch(): | 1054 if actual_url and not scm.DoesRemoteURLMatch(): |
1055 gclient_utils.AddWarning(''' | 1055 raise gclient_utils.Error(''' |
1056 ################################################################################ | |
1057 ################################### WARNING! ################################### | |
1058 ################################################################################ | |
1059 | |
1060 Your .gclient file seems to be broken. The requested URL is different from what | 1056 Your .gclient file seems to be broken. The requested URL is different from what |
1061 is actually checked out in %(checkout_path)s. In the future this will be an | 1057 is actually checked out in %(checkout_path)s. |
1062 error. | |
1063 | 1058 |
1064 Expected: %(expected_url)s (%(expected_scm)s) | 1059 Expected: %(expected_url)s (%(expected_scm)s) |
1065 Actual: %(actual_url)s (%(actual_scm)s) | 1060 Actual: %(actual_url)s (%(actual_scm)s) |
1066 | 1061 |
1067 You should ensure that the URL listed in .gclient is correct and either change | 1062 You should ensure that the URL listed in .gclient is correct and either change |
1068 it or fix the checkout. If you're managing your own git checkout in | 1063 it or fix the checkout. If you're managing your own git checkout in |
1069 %(checkout_path)s but the URL in .gclient is for an svn repository, you probably | 1064 %(checkout_path)s but the URL in .gclient is for an svn repository, you probably |
1070 want to set 'managed': False in .gclient. | 1065 want to set 'managed': False in .gclient. |
1071 | |
1072 ################################################################################ | |
1073 ################################################################################ | |
1074 ################################################################################ | |
1075 ''' % {'checkout_path': os.path.join(self.root_dir, dep.name), | 1066 ''' % {'checkout_path': os.path.join(self.root_dir, dep.name), |
1076 'expected_url': dep.url, | 1067 'expected_url': dep.url, |
1077 'expected_scm': gclient_scm.GetScmName(dep.url), | 1068 'expected_scm': gclient_scm.GetScmName(dep.url), |
1078 'actual_url': actual_url, | 1069 'actual_url': actual_url, |
1079 'actual_scm': gclient_scm.GetScmName(actual_url)}) | 1070 'actual_scm': gclient_scm.GetScmName(actual_url)}) |
1080 | 1071 |
1081 def SetConfig(self, content): | 1072 def SetConfig(self, content): |
1082 assert not self.dependencies | 1073 assert not self.dependencies |
1083 config_dict = {} | 1074 config_dict = {} |
1084 self.config_content = content | 1075 self.config_content = content |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1247 | 1238 |
1248 def RunOnDeps(self, command, args, ignore_requirements=False, progress=True): | 1239 def RunOnDeps(self, command, args, ignore_requirements=False, progress=True): |
1249 """Runs a command on each dependency in a client and its dependencies. | 1240 """Runs a command on each dependency in a client and its dependencies. |
1250 | 1241 |
1251 Args: | 1242 Args: |
1252 command: The command to use (e.g., 'status' or 'diff') | 1243 command: The command to use (e.g., 'status' or 'diff') |
1253 args: list of str - extra arguments to add to the command line. | 1244 args: list of str - extra arguments to add to the command line. |
1254 """ | 1245 """ |
1255 if not self.dependencies: | 1246 if not self.dependencies: |
1256 raise gclient_utils.Error('No solution specified') | 1247 raise gclient_utils.Error('No solution specified') |
| 1248 |
| 1249 self._CheckConfig() |
| 1250 |
1257 revision_overrides = {} | 1251 revision_overrides = {} |
1258 # It's unnecessary to check for revision overrides for 'recurse'. | 1252 # It's unnecessary to check for revision overrides for 'recurse'. |
1259 # Save a few seconds by not calling _EnforceRevisions() in that case. | 1253 # Save a few seconds by not calling _EnforceRevisions() in that case. |
1260 if command not in ('diff', 'recurse', 'runhooks', 'status'): | 1254 if command not in ('diff', 'recurse', 'runhooks', 'status'): |
1261 revision_overrides = self._EnforceRevisions() | 1255 revision_overrides = self._EnforceRevisions() |
1262 pm = None | 1256 pm = None |
1263 # Disable progress for non-tty stdout. | 1257 # Disable progress for non-tty stdout. |
1264 if (sys.stdout.isatty() and not self._options.verbose and progress): | 1258 if (sys.stdout.isatty() and not self._options.verbose and progress): |
1265 if command in ('update', 'revert'): | 1259 if command in ('update', 'revert'): |
1266 pm = Progress('Syncing projects', 1) | 1260 pm = Progress('Syncing projects', 1) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 print(('\nWARNING: \'%s\' is no longer part of this client. ' | 1315 print(('\nWARNING: \'%s\' is no longer part of this client. ' |
1322 'It is recommended that you manually remove it.\n') % | 1316 'It is recommended that you manually remove it.\n') % |
1323 entry_fixed) | 1317 entry_fixed) |
1324 else: | 1318 else: |
1325 # Delete the entry | 1319 # Delete the entry |
1326 print('\n________ deleting \'%s\' in \'%s\'' % ( | 1320 print('\n________ deleting \'%s\' in \'%s\'' % ( |
1327 entry_fixed, self.root_dir)) | 1321 entry_fixed, self.root_dir)) |
1328 gclient_utils.rmtree(e_dir) | 1322 gclient_utils.rmtree(e_dir) |
1329 # record the current list of entries for next time | 1323 # record the current list of entries for next time |
1330 self._SaveEntries() | 1324 self._SaveEntries() |
1331 self._CheckConfig() | |
1332 return 0 | 1325 return 0 |
1333 | 1326 |
1334 def PrintRevInfo(self): | 1327 def PrintRevInfo(self): |
1335 if not self.dependencies: | 1328 if not self.dependencies: |
1336 raise gclient_utils.Error('No solution specified') | 1329 raise gclient_utils.Error('No solution specified') |
1337 # Load all the settings. | 1330 # Load all the settings. |
1338 work_queue = gclient_utils.ExecutionQueue(self._options.jobs, None, False) | 1331 work_queue = gclient_utils.ExecutionQueue(self._options.jobs, None, False) |
1339 for s in self.dependencies: | 1332 for s in self.dependencies: |
1340 work_queue.enqueue(s) | 1333 work_queue.enqueue(s) |
1341 work_queue.flush({}, None, [], options=self._options) | 1334 work_queue.flush({}, None, [], options=self._options) |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1958 print >> sys.stderr, 'Error: %s' % str(e) | 1951 print >> sys.stderr, 'Error: %s' % str(e) |
1959 return 1 | 1952 return 1 |
1960 finally: | 1953 finally: |
1961 gclient_utils.PrintWarnings() | 1954 gclient_utils.PrintWarnings() |
1962 | 1955 |
1963 | 1956 |
1964 if '__main__' == __name__: | 1957 if '__main__' == __name__: |
1965 sys.exit(Main(sys.argv[1:])) | 1958 sys.exit(Main(sys.argv[1:])) |
1966 | 1959 |
1967 # vim: ts=2:sw=2:tw=80:et: | 1960 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |