Commit c57e4f28 authored by maruel@chromium.org's avatar maruel@chromium.org

Make Dependency.subtree() a standalone function for later use.

No behavior change.

TEST=all test still pass
TBR=bradnelson

Review URL: http://codereview.chromium.org/3005026

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@53392 0039d316-1c4b-4281-b951-d872f2087c98
parent bc2d2f90
......@@ -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)
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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment