Index: tools/bisect-perf-regression.py |
diff --git a/tools/bisect-perf-regression.py b/tools/bisect-perf-regression.py |
index 6b98b4b40dcb34b7b2a7ce3f2b3f10b58fad4743..9359a67f50d2f9eb4bb882512e0c8d8296c24027 100755 |
--- a/tools/bisect-perf-regression.py |
+++ b/tools/bisect-perf-regression.py |
@@ -76,7 +76,7 @@ DEPOT_DEPS_NAME = { |
"depends" : None, |
"from" : ['cros', 'android-chrome'], |
'viewvc': 'http://src.chromium.org/viewvc/chrome?view=revision&revision=', |
- 'deps_var': None |
+ 'deps_var': 'chromium_rev' |
}, |
'webkit' : { |
"src" : "src/third_party/WebKit", |
@@ -1367,23 +1367,22 @@ class BisectPerformanceMetrics(object): |
return bleeding_edge_revision |
- def Get3rdPartyRevisionsFromCurrentRevision(self, depot, revision): |
- """Parses the DEPS file to determine WebKit/v8/etc... versions. |
+ def _ParseRevisionsFromDEPSFile(self, depot): |
+ """Parses the local DEPS file to determine blink/skia/v8 revisions which may |
+ be needed if the bisect recurses into those depots later. |
+ |
+ Args: |
+ depot: Depot being bisected. |
Returns: |
A dict in the format {depot:revision} if successful, otherwise None. |
""" |
- cwd = os.getcwd() |
- self.ChangeToDepotWorkingDirectory(depot) |
- |
- results = {} |
- |
- if depot == 'chromium' or depot == 'android-chrome': |
+ try: |
locals = {'Var': lambda _: locals["vars"][_], |
'From': lambda *args: None} |
execfile(bisect_utils.FILE_DEPS_GIT, {}, locals) |
- |
- os.chdir(cwd) |
+ locals = locals['deps'] |
+ results = {} |
rxp = re.compile(".git@(?P<revision>[a-fA-F0-9]+)") |
@@ -1394,28 +1393,65 @@ class BisectPerformanceMetrics(object): |
if (DEPOT_DEPS_NAME[d]['recurse'] and |
depot in DEPOT_DEPS_NAME[d]['from']): |
- if (locals['deps'].has_key(DEPOT_DEPS_NAME[d]['src']) or |
- locals['deps'].has_key(DEPOT_DEPS_NAME[d]['src_old'])): |
- if locals['deps'].has_key(DEPOT_DEPS_NAME[d]['src']): |
- re_results = rxp.search(locals['deps'][DEPOT_DEPS_NAME[d]['src']]) |
+ if (locals.has_key(DEPOT_DEPS_NAME[d]['src']) or |
+ locals.has_key(DEPOT_DEPS_NAME[d]['src_old'])): |
+ if locals.has_key(DEPOT_DEPS_NAME[d]['src']): |
+ re_results = rxp.search(locals[DEPOT_DEPS_NAME[d]['src']]) |
self.depot_cwd[d] = \ |
os.path.join(self.src_cwd, DEPOT_DEPS_NAME[d]['src'][4:]) |
- elif locals['deps'].has_key(DEPOT_DEPS_NAME[d]['src_old']): |
+ elif (DEPOT_DEPS_NAME[d].has_key('src_old') and |
+ locals.has_key(DEPOT_DEPS_NAME[d]['src_old'])): |
re_results = \ |
- rxp.search(locals['deps'][DEPOT_DEPS_NAME[d]['src_old']]) |
+ rxp.search(locals[DEPOT_DEPS_NAME[d]['src_old']]) |
self.depot_cwd[d] = \ |
os.path.join(self.src_cwd, DEPOT_DEPS_NAME[d]['src_old'][4:]) |
if re_results: |
results[d] = re_results.group('revision') |
else: |
- print 'Couldn\'t parse revision for %s.' % d |
- return None |
+ warning_text = ('Couldn\'t parse revision for %s while bisecting ' |
+ '%s' % (d, depot)) |
+ if not warningText in self.warnings: |
+ self.warnings.append(warningText) |
else: |
print 'Couldn\'t find %s while parsing .DEPS.git.' % d |
return None |
+ return results |
+ except ImportError: |
qyearsley
2014/04/25 16:46:19
This block (line 1422 to 1439) is a bit dense, and
shatch
2014/04/25 17:17:14
Done.
|
+ # We'll parse the "vars" section of the DEPS file. |
+ rxp = re.compile("vars = {(?P<revision>[^}]+)", re.MULTILINE) |
qyearsley
2014/04/25 16:46:19
<revision> isn't a very clear name for "everything
shatch
2014/04/25 17:17:14
Done.
|
+ re_results = rxp.search(ReadStringFromFile(bisect_utils.FILE_DEPS_GIT)) |
+ locals = {} |
+ if re_results: |
qyearsley
2014/04/25 16:46:19
To avoid nesting one level here, maybe:
if not re
shatch
2014/04/25 17:17:14
Done.
|
+ for current_line in re_results.group("revision").splitlines(): |
+ try: |
+ depot_name = current_line.split("'")[1].split("'")[0] |
+ depot_revision = current_line.split(": '")[1].split("'")[0] |
qyearsley
2014/04/25 16:46:19
These two lines are particularly hard for me to un
shatch
2014/04/25 17:17:14
Done.
|
+ for current_name, current_data in DEPOT_DEPS_NAME.iteritems(): |
+ if (current_data.has_key('deps_var') and |
+ current_data['deps_var'] == depot_name): |
+ src_name = current_name |
+ locals[src_name] = depot_revision |
+ break |
+ except IndexError: |
+ pass |
+ return locals |
+ |
+ def Get3rdPartyRevisionsFromCurrentRevision(self, depot, revision): |
+ """Parses the DEPS file to determine WebKit/v8/etc... versions. |
+ |
+ Returns: |
+ A dict in the format {depot:revision} if successful, otherwise None. |
+ """ |
+ cwd = os.getcwd() |
+ self.ChangeToDepotWorkingDirectory(depot) |
+ |
+ results = {} |
+ |
+ if depot == 'chromium' or depot == 'android-chrome': |
+ results = self._ParseRevisionsFromDEPSFile(depot) |
+ os.chdir(cwd) |
elif depot == 'cros': |
cmd = [CROS_SDK_PATH, '--', 'portageq-%s' % self.opts.cros_board, |
'best_visible', '/build/%s' % self.opts.cros_board, 'ebuild', |