Index: appengine/findit/common/chromium_deps.py |
diff --git a/appengine/findit/common/chromium_deps.py b/appengine/findit/common/chromium_deps.py |
index 079d67e2dd063fcd74b513c0b80d0510fb626c2d..df0e345dad9578b32c2bc139cf9ff7e1ea327b80 100644 |
--- a/appengine/findit/common/chromium_deps.py |
+++ b/appengine/findit/common/chromium_deps.py |
@@ -9,7 +9,7 @@ from common import deps_parser |
class DEPSDownloader(deps_parser.DEPSLoader): |
- """Download DEPS from remote GIT repo.""" |
+ """Downloads DEPS from remote GIT repo.""" |
def Load(self, repo_url, revision, deps_file): |
http_client = http_client_appengine.HttpClientAppengine() |
@@ -35,7 +35,7 @@ class DEPSDownloader(deps_parser.DEPSLoader): |
def GetChromeDependency(revision, os_platform): |
- """Return all dependencies of Chrome as a dict for the given revision and os. |
+ """Returns all dependencies of Chrome as a dict for the given revision and os. |
Args: |
revision (str): The revision of a Chrome build. |
@@ -54,11 +54,43 @@ def GetChromeDependency(revision, os_platform): |
dependencies = {} |
# Flatten the dependency tree into a one-level dict. |
- def _FlattenDepTree(dep): |
+ def FlattenDepTree(dep): |
dependencies[dep.path] = dep |
for child in dep.children.values(): |
- _FlattenDepTree(child) |
+ FlattenDepTree(child) |
- _FlattenDepTree(root_dep) |
+ FlattenDepTree(root_dep) |
return dependencies |
+ |
+ |
+def GetChromiumDEPSRolls(old_cr_revision, new_cr_revision, os_platform): |
+ """Returns a list of dependency rolls between the given Chromium revisions. |
+ |
+ Args: |
+ old_cr_revision (str): The old Chromium revision. |
+ new_cr_revision (str): The new Chromium revision. |
+ os_platform (str): The target OS platform of the Chrome or test binary. |
+ """ |
+ old_deps = GetChromeDependency(old_cr_revision, os_platform) |
+ new_deps = GetChromeDependency(new_cr_revision, os_platform) |
+ |
+ rolls = [] |
+ |
+ for path, new_dep in new_deps.iteritems(): |
+ if path == 'src/': |
+ continue |
+ |
+ old_revision = None |
+ if path in old_deps: |
+ old_revision = old_deps[path].revision |
+ |
+ if old_revision != new_dep.revision: |
+ rolls.append( |
+ dependency.DependencyRoll( |
+ path, new_dep.repo_url, old_revision, new_dep.revision)) |
+ |
+ # Note: dependencies could be deleted too. However, regressions caused by that |
+ # seems rare. Thus, ignore them for now. |
+ |
+ return rolls |