Index: gclient.py |
diff --git a/gclient.py b/gclient.py |
index 9a722f7253e3cee2844d2574631ad60ec65f7720..d62e77ee58a3c8a49d528407e32377c0c5a5ba02 100644 |
--- a/gclient.py |
+++ b/gclient.py |
@@ -160,9 +160,11 @@ class Dependency(GClientKeywords): |
# Sanity checks |
if not self.name and self.parent: |
raise gclient_utils.Error('Dependency without name') |
- if self.name in [d.name for d in self.tree(False)]: |
- raise gclient_utils.Error('Dependency %s specified more than once' % |
- self.name) |
+ tree = dict((d.name, d) for d in self.tree(False)) |
+ if self.name in tree: |
+ raise gclient_utils.Error( |
+ 'Dependency %s specified more than once:\n %s\nvs\n %s' % |
+ (self.name, tree[self.name].hierarchy(), self.hierarchy())) |
if not isinstance(self.url, |
(basestring, self.FromImpl, self.FileImpl, None.__class__)): |
raise gclient_utils.Error('dependency url must be either a string, None, ' |
@@ -436,6 +438,15 @@ class Dependency(GClientKeywords): |
def __repr__(self): |
return '%s: %s' % (self.name, self.url) |
+ def hierarchy(self): |
+ "Returns a human-readable hierarchical reference to a Dependency." |
bradn
2010/07/22 21:22:25
Uh you'll want a """ here I believe.
|
+ out = '%s(%s)' % (self.name, self.url) |
+ i = self.parent |
+ while i and i.name: |
+ out = '%s(%s) -> %s' % (i.name, i.url, out) |
+ i = i.parent |
+ return out |
+ |
class GClient(Dependency): |
"""Object that represent a gclient checkout. A tree of Dependency(), one per |