From 0cec542e0499487ab2b40416f186986b8464cc12 Mon Sep 17 00:00:00 2001 From: Edward Lesmes Date: Thu, 7 Mar 2019 17:59:36 +0000 Subject: [PATCH] Revert "Avoid unnecessary invocations of "git fetch"" This reverts commit 61a1b5f31059b4ab7ca6870dd798803bdfec4de7. Reason for revert: It's blocking skia autoroller https://skia-review.googlesource.com/c/buildbot/+/198700 Original change's description: > Avoid unnecessary invocations of "git fetch" > > If we already have the correct commit, it is not necessary to fetch. Any > fetches can takes minutes due to gerrit problems, and often fail > completely, so it is helpful to avoid them completely whenever we can. > > Bug: 938627 > > Change-Id: I54494cad9b9aa0090f51674b6b9f56bb3e842f12 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1504102 > Commit-Queue: Michael Spang > Reviewed-by: Edward Lesmes TBR=spang@chromium.org,agable@chromium.org,ehmaldonado@chromium.org Change-Id: If8bd26d74bf84ff0ca69378dbfe6b9369b9988d3 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: 938627 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1508980 Reviewed-by: Edward Lesmes Commit-Queue: Edward Lesmes --- gclient_scm.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/gclient_scm.py b/gclient_scm.py index a95bdab83b..7bed91540c 100644 --- a/gclient_scm.py +++ b/gclient_scm.py @@ -657,18 +657,14 @@ class GitWrapper(SCMWrapper): raise gclient_utils.Error('Invalid Upstream: %s' % upstream_branch) self._SetFetchConfig(options) + self._Fetch(options, prune=options.force) - # Fetch upstream if we don't already have |revision|. if not scm.GIT.IsValidRevision(self.checkout_path, revision, sha_only=True): - self._Fetch(options, prune=options.force) - - if not scm.GIT.IsValidRevision(self.checkout_path, revision, - sha_only=True): - # Update the remotes first so we have all the refs. - remote_output = scm.GIT.Capture(['remote'] + verbose + ['update'], - cwd=self.checkout_path) - if verbose: - self.Print(remote_output) + # Update the remotes first so we have all the refs. + remote_output = scm.GIT.Capture(['remote'] + verbose + ['update'], + cwd=self.checkout_path) + if verbose: + self.Print(remote_output) revision = self._AutoFetchRef(options, revision)