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

Unified Diff: gclient.py

Issue 3005026: Make Dependency.subtree() a standalone function for later use. (Closed)
Patch Set: Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient.py
diff --git a/gclient.py b/gclient.py
index 791c9352dfeec6f0c25f35ac98d5513fd250c765..26c02cd40b8c8b6811c58e00c47b1e6d6190e9a7 100644
--- a/gclient.py
+++ b/gclient.py
@@ -422,6 +422,16 @@ class Dependency(GClientKeywords):
def tree(self, force_all):
return self.parent.tree(force_all)
+ def subtree(self, force_all):
+ result = []
+ # Add breadth-first.
+ if self.direct_reference or force_all:
+ for d in self.dependencies:
+ result.append(d)
bradn 2010/07/22 21:51:49 extra indent here.
+ for d in self.dependencies:
+ result.extend(d.subtree(force_all))
+ return result
+
def get_custom_deps(self, name, url):
"""Returns a custom deps if applicable."""
if self.parent:
@@ -759,16 +769,7 @@ solutions = [
def tree(self, force_all):
"""Returns a flat list of all the dependencies."""
- def subtree(dep):
- if not force_all and not dep.direct_reference:
- # Was loaded from a From() keyword in a DEPS file, don't load all its
- # dependencies.
- return []
- result = dep.dependencies[:]
- for d in dep.dependencies:
- result.extend(subtree(d))
- return result
- return subtree(self)
+ return self.subtree(force_all)
#### gclient commands.
« 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