From d5c0b56e84e0c6f416439ce56c60d617897610fe Mon Sep 17 00:00:00 2001 From: danakj Date: Fri, 8 Nov 2019 17:27:47 +0000 Subject: [PATCH] Use git fetch --no-tags to fetch commits to apply via cherry-pick. This changes the behaviour when applying a patch to not fetch tags along with the patch being applied. The fetch to apply a patch only needs the commits that will be cherry picked, it does not need tags. Fetching tags creates slow bottlenecks if a repo such as chromium has 10k+ tags. Using --no-tags prevents the server from sending the list of all tags and the client from processing them. Bug: 1019824 Change-Id: I756beb8c2b0c7ec3c0fc48b7431d0cf8c0bbbbd3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1894393 Reviewed-by: Edward Lesmes Reviewed-by: Erik Chen Commit-Queue: danakj --- gclient_scm.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gclient_scm.py b/gclient_scm.py index 6301010dd..ae6dc5978 100644 --- a/gclient_scm.py +++ b/gclient_scm.py @@ -419,7 +419,7 @@ class GitWrapper(SCMWrapper): self.Print('Revision to patch is %r @ %r.' % (patch_repo, patch_rev)) self.Print('Current dir is %r' % self.checkout_path) self._Capture(['reset', '--hard']) - self._Capture(['fetch', patch_repo, patch_rev]) + self._Capture(['fetch', '--no-tags', patch_repo, patch_rev]) patch_rev = self._Capture(['rev-parse', 'FETCH_HEAD']) if not options.rebase_patch_ref: @@ -1335,6 +1335,8 @@ class GitWrapper(SCMWrapper): fetch_cmd.append('--prune') if options.verbose: fetch_cmd.append('--verbose') + if not hasattr(options, 'with_tags') or not options.with_tags: + fetch_cmd.append('--no-tags') elif quiet: fetch_cmd.append('--quiet') self._Run(fetch_cmd, options, show_header=options.verbose, retry=True)