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

Side by Side Diff: gclient.py

Issue 233333003: Make it possible to refer to github-style URLs. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 6 years, 8 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_utils.py » ('j') | gclient_utils.py » ('J')
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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 logging.warn('Won\'t process duplicate dependency %s' % sibling) 393 logging.warn('Won\'t process duplicate dependency %s' % sibling)
394 return False 394 return False
395 return True 395 return True
396 396
397 def LateOverride(self, url): 397 def LateOverride(self, url):
398 """Resolves the parsed url from url. 398 """Resolves the parsed url from url.
399 399
400 Manages From() keyword accordingly. Do not touch self.parsed_url nor 400 Manages From() keyword accordingly. Do not touch self.parsed_url nor
401 self.url because it may called with other urls due to From().""" 401 self.url because it may called with other urls due to From()."""
402 assert self.parsed_url == None or not self.should_process, self.parsed_url 402 assert self.parsed_url == None or not self.should_process, self.parsed_url
403 if url.startswith('git@'):
bradn 2014/04/10 22:19:27 Move this down to where url is known to be a strin
Sheridan Rawlins 2014/04/11 01:05:46 Ah, too true - https://www.kernel.org/pub/software
404 return url
403 parsed_url = self.get_custom_deps(self.name, url) 405 parsed_url = self.get_custom_deps(self.name, url)
404 if parsed_url != url: 406 if parsed_url != url:
405 logging.info( 407 logging.info(
406 'Dependency(%s).LateOverride(%s) -> %s' % 408 'Dependency(%s).LateOverride(%s) -> %s' %
407 (self.name, url, parsed_url)) 409 (self.name, url, parsed_url))
408 return parsed_url 410 return parsed_url
409 411
410 if isinstance(url, self.FromImpl): 412 if isinstance(url, self.FromImpl):
411 # Requires tree traversal. 413 # Requires tree traversal.
412 ref = [ 414 ref = [
(...skipping 14 matching lines...) Expand all
427 429
428 # Call LateOverride() again. 430 # Call LateOverride() again.
429 found_dep = found_deps[0] 431 found_dep = found_deps[0]
430 parsed_url = found_dep.LateOverride(found_dep.url) 432 parsed_url = found_dep.LateOverride(found_dep.url)
431 logging.info( 433 logging.info(
432 'Dependency(%s).LateOverride(%s) -> %s (From)' % 434 'Dependency(%s).LateOverride(%s) -> %s (From)' %
433 (self.name, url, parsed_url)) 435 (self.name, url, parsed_url))
434 return parsed_url 436 return parsed_url
435 437
436 if isinstance(url, basestring): 438 if isinstance(url, basestring):
437 parsed_url = urlparse.urlparse(url) 439 parsed_url = urlparse.urlparse(url)
bradn 2014/04/10 22:19:27 in here.
Sheridan Rawlins 2014/04/11 01:05:46 Done.
438 if not parsed_url[0]: 440 if not parsed_url[0]:
439 # A relative url. Fetch the real base. 441 # A relative url. Fetch the real base.
440 path = parsed_url[2] 442 path = parsed_url[2]
441 if not path.startswith('/'): 443 if not path.startswith('/'):
442 raise gclient_utils.Error( 444 raise gclient_utils.Error(
443 'relative DEPS entry \'%s\' must begin with a slash' % url) 445 'relative DEPS entry \'%s\' must begin with a slash' % url)
444 # Create a scm just to query the full url. 446 # Create a scm just to query the full url.
445 parent_url = self.parent.parsed_url 447 parent_url = self.parent.parsed_url
446 if isinstance(parent_url, self.FileImpl): 448 if isinstance(parent_url, self.FileImpl):
447 parent_url = parent_url.file_location 449 parent_url = parent_url.file_location
(...skipping 1518 matching lines...) Expand 10 before | Expand all | Expand 10 after
1966 print >> sys.stderr, 'Error: %s' % str(e) 1968 print >> sys.stderr, 'Error: %s' % str(e)
1967 return 1 1969 return 1
1968 finally: 1970 finally:
1969 gclient_utils.PrintWarnings() 1971 gclient_utils.PrintWarnings()
1970 1972
1971 1973
1972 if '__main__' == __name__: 1974 if '__main__' == __name__:
1973 sys.exit(Main(sys.argv[1:])) 1975 sys.exit(Main(sys.argv[1:]))
1974 1976
1975 # vim: ts=2:sw=2:tw=80:et: 1977 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « no previous file | gclient_utils.py » ('j') | gclient_utils.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698