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

Side by Side Diff: gclient.py

Issue 2018803002: Improve diagnostic message for wrong gclient config (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Fix parens Created 4 years, 6 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
« no previous file with comments | « no previous file | gclient_scm.py » ('j') | 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 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 1226
1227 def _CheckConfig(self): 1227 def _CheckConfig(self):
1228 """Verify that the config matches the state of the existing checked-out 1228 """Verify that the config matches the state of the existing checked-out
1229 solutions.""" 1229 solutions."""
1230 for dep in self.dependencies: 1230 for dep in self.dependencies:
1231 if dep.managed and dep.url: 1231 if dep.managed and dep.url:
1232 scm = gclient_scm.CreateSCM( 1232 scm = gclient_scm.CreateSCM(
1233 dep.url, self.root_dir, dep.name, self.outbuf) 1233 dep.url, self.root_dir, dep.name, self.outbuf)
1234 actual_url = scm.GetActualRemoteURL(self._options) 1234 actual_url = scm.GetActualRemoteURL(self._options)
1235 if actual_url and not scm.DoesRemoteURLMatch(self._options): 1235 if actual_url and not scm.DoesRemoteURLMatch(self._options):
1236 mirror = scm.GetCacheMirror()
1237 if mirror:
1238 mirror_string = '%s (exists=%s)' % (mirror.mirror_path,
1239 mirror.exists())
1240 else:
1241 mirror_string = 'not used'
1236 raise gclient_utils.Error(''' 1242 raise gclient_utils.Error('''
1237 Your .gclient file seems to be broken. The requested URL is different from what 1243 Your .gclient file seems to be broken. The requested URL is different from what
1238 is actually checked out in %(checkout_path)s. 1244 is actually checked out in %(checkout_path)s.
1239 1245
1240 The .gclient file contains: 1246 The .gclient file contains:
1241 %(expected_url)s (%(expected_scm)s) 1247 URL: %(expected_url)s (%(expected_scm)s)
1248 Cache mirror: %(mirror_string)s
1242 1249
1243 The local checkout in %(checkout_path)s reports: 1250 The local checkout in %(checkout_path)s reports:
1244 %(actual_url)s (%(actual_scm)s) 1251 %(actual_url)s (%(actual_scm)s)
1245 1252
1246 You should ensure that the URL listed in .gclient is correct and either change 1253 You should ensure that the URL listed in .gclient is correct and either change
1247 it or fix the checkout. If you're managing your own git checkout in 1254 it or fix the checkout. If you're managing your own git checkout in
1248 %(checkout_path)s but the URL in .gclient is for an svn repository, you probably 1255 %(checkout_path)s but the URL in .gclient is for an svn repository, you probably
1249 want to set 'managed': False in .gclient. 1256 want to set 'managed': False in .gclient.
1250 ''' % {'checkout_path': os.path.join(self.root_dir, dep.name), 1257 ''' % {'checkout_path': os.path.join(self.root_dir, dep.name),
1251 'expected_url': dep.url, 1258 'expected_url': dep.url,
1252 'expected_scm': gclient_scm.GetScmName(dep.url), 1259 'expected_scm': gclient_scm.GetScmName(dep.url),
1260 'mirror_string' : mirror_string,
1253 'actual_url': actual_url, 1261 'actual_url': actual_url,
1254 'actual_scm': gclient_scm.GetScmName(actual_url)}) 1262 'actual_scm': gclient_scm.GetScmName(actual_url)})
1255 1263
1256 def SetConfig(self, content): 1264 def SetConfig(self, content):
1257 assert not self.dependencies 1265 assert not self.dependencies
1258 config_dict = {} 1266 config_dict = {}
1259 self.config_content = content 1267 self.config_content = content
1260 try: 1268 try:
1261 exec(content, config_dict) 1269 exec(content, config_dict)
1262 except SyntaxError as e: 1270 except SyntaxError as e:
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
2342 2350
2343 2351
2344 if '__main__' == __name__: 2352 if '__main__' == __name__:
2345 try: 2353 try:
2346 sys.exit(main(sys.argv[1:])) 2354 sys.exit(main(sys.argv[1:]))
2347 except KeyboardInterrupt: 2355 except KeyboardInterrupt:
2348 sys.stderr.write('interrupted\n') 2356 sys.stderr.write('interrupted\n')
2349 sys.exit(1) 2357 sys.exit(1)
2350 2358
2351 # vim: ts=2:sw=2:tw=80:et: 2359 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « no previous file | gclient_scm.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698