mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
add --no-current-branch option to invert --current-branch
For most commands, this is more about providing a way to undo earlier command line options (e.g. `repo info -c --no-current-branch`) which can be helpful for scripting & automation. But for the sync command, this is helpful to undo the setting that exists in the manifest itself. With this in place, tweak the sync current_branch_only logic to only apply the manifest settings when the user hasn't specified a command line option. Bug: https://crbug.com/gerrit/12401 Change-Id: I21e2384624680cc740d1b5d1e49c50589d2fe6a0 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/304903 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
parent
b8e09ea1d6
commit
7356114d90
@ -1041,7 +1041,7 @@ class Project(object):
|
|||||||
verbose=False,
|
verbose=False,
|
||||||
output_redir=None,
|
output_redir=None,
|
||||||
is_new=None,
|
is_new=None,
|
||||||
current_branch_only=False,
|
current_branch_only=None,
|
||||||
force_sync=False,
|
force_sync=False,
|
||||||
clone_bundle=True,
|
clone_bundle=True,
|
||||||
tags=True,
|
tags=True,
|
||||||
@ -1116,7 +1116,7 @@ class Project(object):
|
|||||||
and self._ApplyCloneBundle(initial=is_new, quiet=quiet, verbose=verbose)):
|
and self._ApplyCloneBundle(initial=is_new, quiet=quiet, verbose=verbose)):
|
||||||
is_new = False
|
is_new = False
|
||||||
|
|
||||||
if not current_branch_only:
|
if current_branch_only is None:
|
||||||
if self.sync_c:
|
if self.sync_c:
|
||||||
current_branch_only = True
|
current_branch_only = True
|
||||||
elif not self.manifest._loaded:
|
elif not self.manifest._loaded:
|
||||||
|
3
repo
3
repo
@ -324,6 +324,9 @@ def InitParser(parser, gitc_init=False):
|
|||||||
group.add_option(*cbr_opts,
|
group.add_option(*cbr_opts,
|
||||||
dest='current_branch_only', action='store_true',
|
dest='current_branch_only', action='store_true',
|
||||||
help='fetch only current manifest branch from server')
|
help='fetch only current manifest branch from server')
|
||||||
|
group.add_option('--no-current-branch',
|
||||||
|
dest='current_branch_only', action='store_false',
|
||||||
|
help='fetch all manifest branches from server')
|
||||||
group.add_option('--no-tags',
|
group.add_option('--no-tags',
|
||||||
dest='tags', default=True, action='store_false',
|
dest='tags', default=True, action='store_false',
|
||||||
help="don't fetch tags in the manifest")
|
help="don't fetch tags in the manifest")
|
||||||
|
@ -39,6 +39,9 @@ class Info(PagedCommand):
|
|||||||
p.add_option('-c', '--current-branch',
|
p.add_option('-c', '--current-branch',
|
||||||
dest="current_branch", action="store_true",
|
dest="current_branch", action="store_true",
|
||||||
help="consider only checked out branches")
|
help="consider only checked out branches")
|
||||||
|
p.add_option('--no-current-branch',
|
||||||
|
dest='current_branch', action='store_false',
|
||||||
|
help='consider all local branches')
|
||||||
# Turn this into a warning & remove this someday.
|
# Turn this into a warning & remove this someday.
|
||||||
p.add_option('-b',
|
p.add_option('-b',
|
||||||
dest='current_branch', action='store_true',
|
dest='current_branch', action='store_true',
|
||||||
|
@ -37,6 +37,9 @@ are displayed.
|
|||||||
p.add_option('-c', '--current-branch',
|
p.add_option('-c', '--current-branch',
|
||||||
dest="current_branch", action="store_true",
|
dest="current_branch", action="store_true",
|
||||||
help="Consider only checked out branches")
|
help="Consider only checked out branches")
|
||||||
|
p.add_option('--no-current-branch',
|
||||||
|
dest='current_branch', action='store_false',
|
||||||
|
help='consider all local branches')
|
||||||
# Turn this into a warning & remove this someday.
|
# Turn this into a warning & remove this someday.
|
||||||
p.add_option('-b',
|
p.add_option('-b',
|
||||||
dest='current_branch', action='store_true',
|
dest='current_branch', action='store_true',
|
||||||
|
@ -213,6 +213,9 @@ later is required to fix a server side protocol bug.
|
|||||||
p.add_option('-c', '--current-branch',
|
p.add_option('-c', '--current-branch',
|
||||||
dest='current_branch_only', action='store_true',
|
dest='current_branch_only', action='store_true',
|
||||||
help='fetch only current branch from server')
|
help='fetch only current branch from server')
|
||||||
|
p.add_option('--no-current-branch',
|
||||||
|
dest='current_branch_only', action='store_false',
|
||||||
|
help='fetch all branches from server')
|
||||||
p.add_option('-m', '--manifest-name',
|
p.add_option('-m', '--manifest-name',
|
||||||
dest='manifest_name',
|
dest='manifest_name',
|
||||||
help='temporary manifest to use for this sync', metavar='NAME.xml')
|
help='temporary manifest to use for this sync', metavar='NAME.xml')
|
||||||
|
@ -174,6 +174,9 @@ Gerrit Code Review: https://www.gerritcodereview.com/
|
|||||||
p.add_option('-c', '--current-branch',
|
p.add_option('-c', '--current-branch',
|
||||||
dest='current_branch', action='store_true',
|
dest='current_branch', action='store_true',
|
||||||
help='Upload current git branch.')
|
help='Upload current git branch.')
|
||||||
|
p.add_option('--no-current-branch',
|
||||||
|
dest='current_branch', action='store_false',
|
||||||
|
help='Upload all git branches.')
|
||||||
# Turn this into a warning & remove this someday.
|
# Turn this into a warning & remove this someday.
|
||||||
p.add_option('--cbr',
|
p.add_option('--cbr',
|
||||||
dest='current_branch', action='store_true',
|
dest='current_branch', action='store_true',
|
||||||
|
Loading…
Reference in New Issue
Block a user