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:
Mike Frysinger
2021-05-03 01:10:09 -04:00
parent b8e09ea1d6
commit 7356114d90
6 changed files with 17 additions and 2 deletions

View File

@@ -1041,7 +1041,7 @@ class Project(object):
verbose=False,
output_redir=None,
is_new=None,
current_branch_only=False,
current_branch_only=None,
force_sync=False,
clone_bundle=True,
tags=True,
@@ -1116,7 +1116,7 @@ class Project(object):
and self._ApplyCloneBundle(initial=is_new, quiet=quiet, verbose=verbose)):
is_new = False
if not current_branch_only:
if current_branch_only is None:
if self.sync_c:
current_branch_only = True
elif not self.manifest._loaded: