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

Side by Side Diff: gclient.py

Issue 11088023: Fix multi-solution use case with conflicting custom_deps overrides. (Closed) Base URL: https://git.chromium.org/chromium/tools/depot_tools.git@master
Patch Set: Created 8 years, 2 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 | 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 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 raise gclient_utils.Error( 318 raise gclient_utils.Error(
319 'The same name "%s" appears multiple times in the deps section' % 319 'The same name "%s" appears multiple times in the deps section' %
320 self.name) 320 self.name)
321 if not self.should_process: 321 if not self.should_process:
322 # Return early, no need to set requirements. 322 # Return early, no need to set requirements.
323 return True 323 return True
324 324
325 # This require a full tree traversal with locks. 325 # This require a full tree traversal with locks.
326 siblings = [d for d in self.root.subtree(False) if d.name == self.name] 326 siblings = [d for d in self.root.subtree(False) if d.name == self.name]
327 for sibling in siblings: 327 for sibling in siblings:
328 if self.url != sibling.url: 328 self_url = self.LateOverride(self.url)
329 raise gclient_utils.Error( 329 sibling_url = sibling.LateOverride(sibling.url)
330 'Dependency %s specified more than once:\n %s\nvs\n %s' % 330 if self_url != sibling_url:
szager1 2012/10/09 18:30:11 if self_url and sibling_url and self_url != siblin
M-A Ruel 2012/10/09 18:38:22 Agreed, I changed it.
331 (self.name, sibling.hierarchy(), self.hierarchy())) 331 # Allow to have only one to be None.
332 if bool(self_url is None) == bool(sibling_url is None):
333 raise gclient_utils.Error(
334 ('Dependency %s specified more than once:\n'
335 ' %s [%s]\n'
336 'vs\n'
337 ' %s [%s]') % (
338 self.name,
339 sibling.hierarchy(),
340 sibling_url,
341 self.hierarchy(),
342 self_url))
332 # In theory we could keep it as a shadow of the other one. In 343 # In theory we could keep it as a shadow of the other one. In
333 # practice, simply ignore it. 344 # practice, simply ignore it.
334 logging.warn('Won\'t process duplicate dependency %s' % sibling) 345 logging.warn('Won\'t process duplicate dependency %s' % sibling)
335 return False 346 return False
336 return True 347 return True
337 348
338 def LateOverride(self, url): 349 def LateOverride(self, url):
339 """Resolves the parsed url from url. 350 """Resolves the parsed url from url.
340 351
341 Manages From() keyword accordingly. Do not touch self.parsed_url nor 352 Manages From() keyword accordingly. Do not touch self.parsed_url nor
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 except (gclient_utils.Error, subprocess2.CalledProcessError), e: 1634 except (gclient_utils.Error, subprocess2.CalledProcessError), e:
1624 print >> sys.stderr, 'Error: %s' % str(e) 1635 print >> sys.stderr, 'Error: %s' % str(e)
1625 return 1 1636 return 1
1626 1637
1627 1638
1628 if '__main__' == __name__: 1639 if '__main__' == __name__:
1629 fix_encoding.fix_encoding() 1640 fix_encoding.fix_encoding()
1630 sys.exit(Main(sys.argv[1:])) 1641 sys.exit(Main(sys.argv[1:]))
1631 1642
1632 # vim: ts=2:sw=2:tw=80:et: 1643 # 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