Commit 3d7cbce9 authored by Josip Sokcevic's avatar Josip Sokcevic Committed by LUCI CQ

Fetch remote when applying patches in gclient

Remote references may not be up-to-date, resulting in cherry-picking way
more changes than needed. In such scenario, it is possible that some
cherry-picking results in conflict and therefore fails gclient sync.

R=gavinmak@google.com

Bug: 1255178
Change-Id: Ibc67ae06c5798286b7510e4119d882053dc9b73f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3206616Reviewed-by: 's avatarGavin Mak <gavinmak@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
parent 29521bc6
......@@ -396,6 +396,9 @@ class GitWrapper(SCMWrapper):
self.Print('Trying the corresponding remote ref for %r: %r\n' % (
target_rev, remote_ref))
if scm.GIT.IsValidRevision(self.checkout_path, remote_ref):
# refs/remotes may need to be updated to cleanly cherry-pick changes.
# See https://crbug.com/1255178.
self._Capture(['fetch', '--no-tags', self.remote, target_rev])
target_rev = remote_ref
elif not scm.GIT.IsValidRevision(self.checkout_path, target_rev):
# Fetch |target_rev| if it's not already available.
......
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