bisect-kit: support chrome new DEPS syntax and layout
Since chrome branch 3420, its DEPS use new recursedeps syntax and
moved source of truth of branch DEPS from buildspec repo to chromium
tree. This CL supports chrome's new DEPS.
On the other hand, this bisector no longer support chrome branches
ealier than 3420. If you need to bisect earlier branches:
- If the development is still on master, you may use bisect_cr_localbuild_master.py
- If you need to bisect branched versions, please checkout old code
before this commit.
BUG=chromium:850443
TEST=unittest; run bisect_cr_localbuild_internal.py against chrome after branch 3420
Change-Id: I240a7bfd5acb075ac64e3336bf7396684a7a6f6f
Reviewed-on: https://chromium-review.googlesource.com/1218247
Commit-Ready: Kuang-che Wu <kcwu@chromium.org>
Tested-by: Kuang-che Wu <kcwu@chromium.org>
Reviewed-by: Chung-yih Wang <cywang@chromium.org>
diff --git a/bisect_kit/codechange.py b/bisect_kit/codechange.py
index f301c4b..8664fee 100644
--- a/bisect_kit/codechange.py
+++ b/bisect_kit/codechange.py
@@ -521,7 +521,7 @@
git_root = self.cached_git_root(spec[path].repo_url)
# spec[path].at is remote reference name. Since git_root is a mirror (not
# a local checkout), there is no need to convert the name.
- return git_util.get_rev_by_time(git_root, timestamp, branch=spec[path].at)
+ return git_util.get_rev_by_time(git_root, timestamp, spec[path].at)
def get_actions_between_two_commit(self, spec, path, old, new):
git_root = self.cached_git_root(spec[path].repo_url)
@@ -711,10 +711,15 @@
scores = []
for i in compatible_candidates:
- scores.append((specs[i].similar_score(target), i))
+ # Tie-break: prefer earlier timestamp and smaller difference.
+ if specs[i].timestamp <= target.timestamp:
+ timediff = 0, target.timestamp - specs[i].timestamp
+ else:
+ timediff = 1, specs[i].timestamp - target.timestamp
+ scores.append((specs[i].similar_score(target), timediff, i))
scores.sort()
- score, index = scores[0]
+ score, _, index = scores[0]
if score != 0:
logger.warning('not exactly match (score=%s): %s', score, target.name)
target.diff(specs[index])