Fix external changes patching when issue number ends with <= 09

A change ref's format is: refs/changes/X/Y/Z where X is last two digits of the CL number, Y is the entire number, and Z is the patchset number.

In cases where Y ends in XXXX09, for example, we incorrectly fetch
refs/9/XXXX09 instead of refs/09/XXXX09.

Bug: 1382528
Change-Id: Icc0b08e9ee451a75c07039913418a6802b2b62fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4080591
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Auto-Submit: Gavin Mak <gavinmak@google.com>
changes/91/4080591/3
Gavin Mak 2 years ago committed by LUCI CQ
parent 25334bb18e
commit 591ebafe68

@ -2789,7 +2789,7 @@ class Changelist(object):
# Get the diff between local_ps and external_ps.
issue = self.GetIssue()
changes_ref = 'refs/changes/%d/%d/' % (issue % 100, issue)
changes_ref = 'refs/changes/%02d/%d/' % (issue % 100, issue)
RunGitSilent(['fetch', remote, changes_ref + str(local_ps)])
last_uploaded = RunGitSilent(['rev-parse', 'FETCH_HEAD']).strip()
RunGitSilent(['fetch', remote, changes_ref + str(external_ps)])

Loading…
Cancel
Save