summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMitchel Humpherys <mitchelh@codeaurora.org>2012-10-29 10:18:34 -0700
committerDavid Pursehouse <david.pursehouse@sonymobile.com>2013-02-27 11:00:49 +0900
commit597868b4c45bba380249b739c0cf49b868cc8741 (patch)
tree938a73ec3df796449207c695a4ee316d4886b0fe
parent75b4c2deac9ff23a5a3c24b3d2450cd23ae3d705 (diff)
downloadgit-repo-597868b4c45bba380249b739c0cf49b868cc8741.tar.gz
Add --no-tags option to prevent fetching of tags
Add an option to pass `--no-tags' to `git fetch'. Change-Id: I4158cc369773e08e55a167091c38ca304a197587 Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
-rw-r--r--project.py14
-rw-r--r--subcmds/sync.py12
2 files changed, 19 insertions, 7 deletions
diff --git a/project.py b/project.py
index ba7898ed..295fb10f 100644
--- a/project.py
+++ b/project.py
@@ -963,7 +963,8 @@ class Project(object):
963 quiet=False, 963 quiet=False,
964 is_new=None, 964 is_new=None,
965 current_branch_only=False, 965 current_branch_only=False,
966 clone_bundle=True): 966 clone_bundle=True,
967 no_tags=False):
967 """Perform only the network IO portion of the sync process. 968 """Perform only the network IO portion of the sync process.
968 Local working directory/branch state is not affected. 969 Local working directory/branch state is not affected.
969 """ 970 """
@@ -1001,7 +1002,8 @@ class Project(object):
1001 current_branch_only = True 1002 current_branch_only = True
1002 1003
1003 if not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir, 1004 if not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir,
1004 current_branch_only=current_branch_only): 1005 current_branch_only=current_branch_only,
1006 no_tags=no_tags):
1005 return False 1007 return False
1006 1008
1007 if self.worktree: 1009 if self.worktree:
@@ -1551,7 +1553,8 @@ class Project(object):
1551 current_branch_only=False, 1553 current_branch_only=False,
1552 initial=False, 1554 initial=False,
1553 quiet=False, 1555 quiet=False,
1554 alt_dir=None): 1556 alt_dir=None,
1557 no_tags=False):
1555 1558
1556 is_sha1 = False 1559 is_sha1 = False
1557 tag_name = None 1560 tag_name = None
@@ -1644,7 +1647,10 @@ class Project(object):
1644 1647
1645 if not current_branch_only: 1648 if not current_branch_only:
1646 # Fetch whole repo 1649 # Fetch whole repo
1647 cmd.append('--tags') 1650 if no_tags:
1651 cmd.append('--no-tags')
1652 else:
1653 cmd.append('--tags')
1648 cmd.append((u'+refs/heads/*:') + remote.ToLocal('refs/heads/*')) 1654 cmd.append((u'+refs/heads/*:') + remote.ToLocal('refs/heads/*'))
1649 elif tag_name is not None: 1655 elif tag_name is not None:
1650 cmd.append('tag') 1656 cmd.append('tag')
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 228a279a..5c369a74 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -189,6 +189,9 @@ later is required to fix a server side protocol bug.
189 p.add_option('--fetch-submodules', 189 p.add_option('--fetch-submodules',
190 dest='fetch_submodules', action='store_true', 190 dest='fetch_submodules', action='store_true',
191 help='fetch submodules from server') 191 help='fetch submodules from server')
192 p.add_option('--no-tags',
193 dest='no_tags', action='store_true',
194 help="don't fetch tags")
192 if show_smart: 195 if show_smart:
193 p.add_option('-s', '--smart-sync', 196 p.add_option('-s', '--smart-sync',
194 dest='smart_sync', action='store_true', 197 dest='smart_sync', action='store_true',
@@ -235,7 +238,8 @@ later is required to fix a server side protocol bug.
235 success = project.Sync_NetworkHalf( 238 success = project.Sync_NetworkHalf(
236 quiet=opt.quiet, 239 quiet=opt.quiet,
237 current_branch_only=opt.current_branch_only, 240 current_branch_only=opt.current_branch_only,
238 clone_bundle=not opt.no_clone_bundle) 241 clone_bundle=not opt.no_clone_bundle,
242 no_tags=opt.no_tags)
239 self._fetch_times.Set(project, time.time() - start) 243 self._fetch_times.Set(project, time.time() - start)
240 244
241 # Lock around all the rest of the code, since printing, updating a set 245 # Lock around all the rest of the code, since printing, updating a set
@@ -273,7 +277,8 @@ later is required to fix a server side protocol bug.
273 if project.Sync_NetworkHalf( 277 if project.Sync_NetworkHalf(
274 quiet=opt.quiet, 278 quiet=opt.quiet,
275 current_branch_only=opt.current_branch_only, 279 current_branch_only=opt.current_branch_only,
276 clone_bundle=not opt.no_clone_bundle): 280 clone_bundle=not opt.no_clone_bundle,
281 no_tags=opt.no_tags):
277 fetched.add(project.gitdir) 282 fetched.add(project.gitdir)
278 else: 283 else:
279 print('error: Cannot fetch %s' % project.name, file=sys.stderr) 284 print('error: Cannot fetch %s' % project.name, file=sys.stderr)
@@ -558,7 +563,8 @@ later is required to fix a server side protocol bug.
558 563
559 if not opt.local_only: 564 if not opt.local_only:
560 mp.Sync_NetworkHalf(quiet=opt.quiet, 565 mp.Sync_NetworkHalf(quiet=opt.quiet,
561 current_branch_only=opt.current_branch_only) 566 current_branch_only=opt.current_branch_only,
567 no_tags=opt.no_tags)
562 568
563 if mp.HasChanges: 569 if mp.HasChanges:
564 syncbuf = SyncBuffer(mp.config) 570 syncbuf = SyncBuffer(mp.config)