Fix the commit difference computation in roll_deps

(can't use commit hashes...)

TBR=phoglund@webrtc.org

Bug: webrtc:8688
No-Try: True
Change-Id: I60d7f72c1fcf2b9cfae4ba780cb3fa97ff347127
Reviewed-on: https://webrtc-review.googlesource.com/36442
Commit-Queue: Oleh Prypin <oprypin@webrtc.org>
Reviewed-by: Oleh Prypin <oprypin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21455}
This commit is contained in:
Oleh Prypin
2017-12-27 21:03:55 +01:00
committed by Commit Bot
parent 65fb17bc28
commit 16b2a3633d

View File

@ -91,7 +91,7 @@ def ParseCommitPosition(commit_message):
for line in reversed(commit_message.splitlines()):
m = COMMIT_POSITION_RE.match(line.strip())
if m:
return m.group(1)
return int(m.group(1))
logging.error('Failed to parse commit position id from:\n%s\n',
commit_message)
sys.exit(-1)
@ -403,10 +403,10 @@ def _LocalCommit(commit_msg, dry_run):
_RunCommand(['git', 'commit', '-m', commit_msg])
def ShouldUseCQ(skip_cq, cq_over, current_cr_rev, new_cr_rev):
def ShouldUseCQ(skip_cq, cq_over, current_commit_pos, new_commit_pos):
if skip_cq:
return 0
if (new_cr_rev - current_cr_rev) < cq_over:
if (new_commit_pos - current_commit_pos) < cq_over:
return 1
return 2
@ -504,7 +504,7 @@ def main():
else:
_LocalCommit(commit_msg, opts.dry_run)
commit_queue = ShouldUseCQ(opts.skip_cq, opts.cq_over,
current_cr_rev, new_cr_rev)
current_commit_pos, new_commit_pos)
_UploadCL(opts.dry_run, commit_queue)
return 0