Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: gclient.py

Issue 213483003: Revert "gclient: Change the .gclient URL mismatch warning into an error." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 raise gclient_utils.Error(''' 1055 gclient_utils.AddWarning('''
1056 ################################################################################
1057 ################################### WARNING! ###################################
1058 ################################################################################
1059
1056 Your .gclient file seems to be broken. The requested URL is different from what 1060 Your .gclient file seems to be broken. The requested URL is different from what
1057 is actually checked out in %(checkout_path)s. 1061 is actually checked out in %(checkout_path)s. In the future this will be an
1062 error.
1058 1063
1059 Expected: %(expected_url)s (%(expected_scm)s) 1064 Expected: %(expected_url)s (%(expected_scm)s)
1060 Actual: %(actual_url)s (%(actual_scm)s) 1065 Actual: %(actual_url)s (%(actual_scm)s)
1061 1066
1062 You should ensure that the URL listed in .gclient is correct and either change 1067 You should ensure that the URL listed in .gclient is correct and either change
1063 it or fix the checkout. If you're managing your own git checkout in 1068 it or fix the checkout. If you're managing your own git checkout in
1064 %(checkout_path)s but the URL in .gclient is for an svn repository, you probably 1069 %(checkout_path)s but the URL in .gclient is for an svn repository, you probably
1065 want to set 'managed': False in .gclient. 1070 want to set 'managed': False in .gclient.
1071
1072 ################################################################################
1073 ################################################################################
1074 ################################################################################
1066 ''' % {'checkout_path': os.path.join(self.root_dir, dep.name), 1075 ''' % {'checkout_path': os.path.join(self.root_dir, dep.name),
1067 'expected_url': dep.url, 1076 'expected_url': dep.url,
1068 'expected_scm': gclient_scm.GetScmName(dep.url), 1077 'expected_scm': gclient_scm.GetScmName(dep.url),
1069 'actual_url': actual_url, 1078 'actual_url': actual_url,
1070 'actual_scm': gclient_scm.GetScmName(actual_url)}) 1079 'actual_scm': gclient_scm.GetScmName(actual_url)})
1071 1080
1072 def SetConfig(self, content): 1081 def SetConfig(self, content):
1073 assert not self.dependencies 1082 assert not self.dependencies
1074 config_dict = {} 1083 config_dict = {}
1075 self.config_content = content 1084 self.config_content = content
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 1247
1239 def RunOnDeps(self, command, args, ignore_requirements=False, progress=True): 1248 def RunOnDeps(self, command, args, ignore_requirements=False, progress=True):
1240 """Runs a command on each dependency in a client and its dependencies. 1249 """Runs a command on each dependency in a client and its dependencies.
1241 1250
1242 Args: 1251 Args:
1243 command: The command to use (e.g., 'status' or 'diff') 1252 command: The command to use (e.g., 'status' or 'diff')
1244 args: list of str - extra arguments to add to the command line. 1253 args: list of str - extra arguments to add to the command line.
1245 """ 1254 """
1246 if not self.dependencies: 1255 if not self.dependencies:
1247 raise gclient_utils.Error('No solution specified') 1256 raise gclient_utils.Error('No solution specified')
1248
1249 self._CheckConfig()
1250
1251 revision_overrides = {} 1257 revision_overrides = {}
1252 # It's unnecessary to check for revision overrides for 'recurse'. 1258 # It's unnecessary to check for revision overrides for 'recurse'.
1253 # Save a few seconds by not calling _EnforceRevisions() in that case. 1259 # Save a few seconds by not calling _EnforceRevisions() in that case.
1254 if command not in ('diff', 'recurse', 'runhooks', 'status'): 1260 if command not in ('diff', 'recurse', 'runhooks', 'status'):
1255 revision_overrides = self._EnforceRevisions() 1261 revision_overrides = self._EnforceRevisions()
1256 pm = None 1262 pm = None
1257 # Disable progress for non-tty stdout. 1263 # Disable progress for non-tty stdout.
1258 if (sys.stdout.isatty() and not self._options.verbose and progress): 1264 if (sys.stdout.isatty() and not self._options.verbose and progress):
1259 if command in ('update', 'revert'): 1265 if command in ('update', 'revert'):
1260 pm = Progress('Syncing projects', 1) 1266 pm = Progress('Syncing projects', 1)
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 print(('\nWARNING: \'%s\' is no longer part of this client. ' 1321 print(('\nWARNING: \'%s\' is no longer part of this client. '
1316 'It is recommended that you manually remove it.\n') % 1322 'It is recommended that you manually remove it.\n') %
1317 entry_fixed) 1323 entry_fixed)
1318 else: 1324 else:
1319 # Delete the entry 1325 # Delete the entry
1320 print('\n________ deleting \'%s\' in \'%s\'' % ( 1326 print('\n________ deleting \'%s\' in \'%s\'' % (
1321 entry_fixed, self.root_dir)) 1327 entry_fixed, self.root_dir))
1322 gclient_utils.rmtree(e_dir) 1328 gclient_utils.rmtree(e_dir)
1323 # record the current list of entries for next time 1329 # record the current list of entries for next time
1324 self._SaveEntries() 1330 self._SaveEntries()
1331 self._CheckConfig()
1325 return 0 1332 return 0
1326 1333
1327 def PrintRevInfo(self): 1334 def PrintRevInfo(self):
1328 if not self.dependencies: 1335 if not self.dependencies:
1329 raise gclient_utils.Error('No solution specified') 1336 raise gclient_utils.Error('No solution specified')
1330 # Load all the settings. 1337 # Load all the settings.
1331 work_queue = gclient_utils.ExecutionQueue(self._options.jobs, None, False) 1338 work_queue = gclient_utils.ExecutionQueue(self._options.jobs, None, False)
1332 for s in self.dependencies: 1339 for s in self.dependencies:
1333 work_queue.enqueue(s) 1340 work_queue.enqueue(s)
1334 work_queue.flush({}, None, [], options=self._options) 1341 work_queue.flush({}, None, [], options=self._options)
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1951 print >> sys.stderr, 'Error: %s' % str(e) 1958 print >> sys.stderr, 'Error: %s' % str(e)
1952 return 1 1959 return 1
1953 finally: 1960 finally:
1954 gclient_utils.PrintWarnings() 1961 gclient_utils.PrintWarnings()
1955 1962
1956 1963
1957 if '__main__' == __name__: 1964 if '__main__' == __name__:
1958 sys.exit(Main(sys.argv[1:])) 1965 sys.exit(Main(sys.argv[1:]))
1959 1966
1960 # vim: ts=2:sw=2:tw=80:et: 1967 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698