Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(930)

Unified Diff: gclient_scm.py

Issue 490743002: Add --with_tags to enable git tag fetching. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gclient.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_scm.py
diff --git a/gclient_scm.py b/gclient_scm.py
index d457a5c5a5fc8b7f6450656d0a5ce45fcc1192ed..acebb099637dd0b486079f766657a98feecc294d 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -785,6 +785,8 @@ class GitWrapper(SCMWrapper):
# mirror_kwargs['refs'].extend(['refs/tags/lkgr', 'refs/tags/lkcr'])
if hasattr(options, 'with_branch_heads') and options.with_branch_heads:
mirror_kwargs['refs'].append('refs/branch-heads/*')
+ if hasattr(options, 'with_tags') and options.with_tags:
+ mirror_kwargs['refs'].append('refs/tags/*')
return git_cache.Mirror(url, **mirror_kwargs)
@staticmethod
@@ -1075,14 +1077,23 @@ class GitWrapper(SCMWrapper):
return self._Capture(['rev-parse', '--verify', 'FETCH_HEAD'])
def _UpdateBranchHeads(self, options, fetch=False):
- """Adds, and optionally fetches, "branch-heads" refspecs if requested."""
+ """Adds, and optionally fetches, "branch-heads" and "tags" refspecs
+ if requested."""
+ need_fetch = fetch
if hasattr(options, 'with_branch_heads') and options.with_branch_heads:
config_cmd = ['config', 'remote.%s.fetch' % self.remote,
'+refs/branch-heads/*:refs/remotes/branch-heads/*',
'^\\+refs/branch-heads/\\*:.*$']
self._Run(config_cmd, options)
- if fetch:
- self._Fetch(options)
+ need_fetch = True
+ if hasattr(options, 'with_tags') and options.with_tags:
+ config_cmd = ['config', 'remote.%s.fetch' % self.remote,
+ '+refs/tags/*:refs/tags/*',
+ '^\\+refs/tags/\\*:.*$']
+ self._Run(config_cmd, options)
+ need_fetch = True
+ if fetch and need_fetch:
+ self._Fetch(options)
def _Run(self, args, options, show_header=True, **kwargs):
# Disable 'unused options' warning | pylint: disable=W0613
« no previous file with comments | « gclient.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698