Commit f627d9fc authored by Edward Lesmes's avatar Edward Lesmes Committed by LUCI CQ

gclient: Apply on patch of remote's branch-heads instead of local.

refs/branch-heads/ might be out of date, as bot_update is now fetching
refs/branch-heads/* as refs/remotes/branch-heads/*.

Bug: 1108638
Change-Id: I5a221e8e01017552f42c0c52d7ef7327acc5f63e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2316327Reviewed-by: 's avatarMichael Moss <mmoss@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
parent cebfb4e6
......@@ -386,10 +386,11 @@ class GitWrapper(SCMWrapper):
if not target_rev:
raise gclient_utils.Error('A target revision for the patch must be given')
elif target_rev.startswith('refs/heads/'):
# If |target_rev| is in refs/heads/**, try first to find the corresponding
# remote ref for it, since |target_rev| might point to a local ref which
# is not up to date with the corresponding remote ref.
elif target_rev.startswith(('refs/heads/', 'refs/branch-heads')):
# If |target_rev| is in refs/heads/** or refs/branch-heads/**, try first
# to find the corresponding remote ref for it, since |target_rev| might
# point to a local ref which is not up to date with the corresponding
# remote ref.
remote_ref = ''.join(scm.GIT.RefToRemoteRef(target_rev, self.remote))
self.Print('Trying the corresponding remote ref for %r: %r\n' % (
target_rev, remote_ref))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment