mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-23 07:16:21 +00:00
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>
This commit is contained in:
parent
75b4c2deac
commit
597868b4c4
14
project.py
14
project.py
@ -963,7 +963,8 @@ class Project(object):
|
|||||||
quiet=False,
|
quiet=False,
|
||||||
is_new=None,
|
is_new=None,
|
||||||
current_branch_only=False,
|
current_branch_only=False,
|
||||||
clone_bundle=True):
|
clone_bundle=True,
|
||||||
|
no_tags=False):
|
||||||
"""Perform only the network IO portion of the sync process.
|
"""Perform only the network IO portion of the sync process.
|
||||||
Local working directory/branch state is not affected.
|
Local working directory/branch state is not affected.
|
||||||
"""
|
"""
|
||||||
@ -1001,7 +1002,8 @@ class Project(object):
|
|||||||
current_branch_only = True
|
current_branch_only = True
|
||||||
|
|
||||||
if not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir,
|
if not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir,
|
||||||
current_branch_only=current_branch_only):
|
current_branch_only=current_branch_only,
|
||||||
|
no_tags=no_tags):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if self.worktree:
|
if self.worktree:
|
||||||
@ -1551,7 +1553,8 @@ class Project(object):
|
|||||||
current_branch_only=False,
|
current_branch_only=False,
|
||||||
initial=False,
|
initial=False,
|
||||||
quiet=False,
|
quiet=False,
|
||||||
alt_dir=None):
|
alt_dir=None,
|
||||||
|
no_tags=False):
|
||||||
|
|
||||||
is_sha1 = False
|
is_sha1 = False
|
||||||
tag_name = None
|
tag_name = None
|
||||||
@ -1644,7 +1647,10 @@ class Project(object):
|
|||||||
|
|
||||||
if not current_branch_only:
|
if not current_branch_only:
|
||||||
# Fetch whole repo
|
# Fetch whole repo
|
||||||
cmd.append('--tags')
|
if no_tags:
|
||||||
|
cmd.append('--no-tags')
|
||||||
|
else:
|
||||||
|
cmd.append('--tags')
|
||||||
cmd.append((u'+refs/heads/*:') + remote.ToLocal('refs/heads/*'))
|
cmd.append((u'+refs/heads/*:') + remote.ToLocal('refs/heads/*'))
|
||||||
elif tag_name is not None:
|
elif tag_name is not None:
|
||||||
cmd.append('tag')
|
cmd.append('tag')
|
||||||
|
@ -189,6 +189,9 @@ later is required to fix a server side protocol bug.
|
|||||||
p.add_option('--fetch-submodules',
|
p.add_option('--fetch-submodules',
|
||||||
dest='fetch_submodules', action='store_true',
|
dest='fetch_submodules', action='store_true',
|
||||||
help='fetch submodules from server')
|
help='fetch submodules from server')
|
||||||
|
p.add_option('--no-tags',
|
||||||
|
dest='no_tags', action='store_true',
|
||||||
|
help="don't fetch tags")
|
||||||
if show_smart:
|
if show_smart:
|
||||||
p.add_option('-s', '--smart-sync',
|
p.add_option('-s', '--smart-sync',
|
||||||
dest='smart_sync', action='store_true',
|
dest='smart_sync', action='store_true',
|
||||||
@ -235,7 +238,8 @@ later is required to fix a server side protocol bug.
|
|||||||
success = project.Sync_NetworkHalf(
|
success = project.Sync_NetworkHalf(
|
||||||
quiet=opt.quiet,
|
quiet=opt.quiet,
|
||||||
current_branch_only=opt.current_branch_only,
|
current_branch_only=opt.current_branch_only,
|
||||||
clone_bundle=not opt.no_clone_bundle)
|
clone_bundle=not opt.no_clone_bundle,
|
||||||
|
no_tags=opt.no_tags)
|
||||||
self._fetch_times.Set(project, time.time() - start)
|
self._fetch_times.Set(project, time.time() - start)
|
||||||
|
|
||||||
# Lock around all the rest of the code, since printing, updating a set
|
# 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.
|
|||||||
if project.Sync_NetworkHalf(
|
if project.Sync_NetworkHalf(
|
||||||
quiet=opt.quiet,
|
quiet=opt.quiet,
|
||||||
current_branch_only=opt.current_branch_only,
|
current_branch_only=opt.current_branch_only,
|
||||||
clone_bundle=not opt.no_clone_bundle):
|
clone_bundle=not opt.no_clone_bundle,
|
||||||
|
no_tags=opt.no_tags):
|
||||||
fetched.add(project.gitdir)
|
fetched.add(project.gitdir)
|
||||||
else:
|
else:
|
||||||
print('error: Cannot fetch %s' % project.name, file=sys.stderr)
|
print('error: Cannot fetch %s' % project.name, file=sys.stderr)
|
||||||
@ -558,7 +563,8 @@ later is required to fix a server side protocol bug.
|
|||||||
|
|
||||||
if not opt.local_only:
|
if not opt.local_only:
|
||||||
mp.Sync_NetworkHalf(quiet=opt.quiet,
|
mp.Sync_NetworkHalf(quiet=opt.quiet,
|
||||||
current_branch_only=opt.current_branch_only)
|
current_branch_only=opt.current_branch_only,
|
||||||
|
no_tags=opt.no_tags)
|
||||||
|
|
||||||
if mp.HasChanges:
|
if mp.HasChanges:
|
||||||
syncbuf = SyncBuffer(mp.config)
|
syncbuf = SyncBuffer(mp.config)
|
||||||
|
Loading…
Reference in New Issue
Block a user