From d68ed63328fedaf227e61390267d06637edbafae Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 3 May 2021 01:21:35 -0400 Subject: [PATCH] init/sync: add --no-tags to match --tags While this provides a way to undo earlier command line options (e.g. `repo sync --tags --no-tags`) which can be helpful for scripting & automation, this more importantly allows the user to override the manifest settings for syncing tags from a project. Bug: https://crbug.com/gerrit/12401 Change-Id: Id4c36cd82e6ca7cb073b5d63a09f6c7ccdebba83 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/304904 Reviewed-by: Raman Tenneti Tested-by: Mike Frysinger --- project.py | 6 +++--- repo | 5 ++++- subcmds/sync.py | 5 ++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/project.py b/project.py index ab28f2c3..99419f61 100644 --- a/project.py +++ b/project.py @@ -1044,7 +1044,7 @@ class Project(object): current_branch_only=None, force_sync=False, clone_bundle=True, - tags=True, + tags=None, archive=False, optimized_fetch=False, retry_fetches=0, @@ -1125,8 +1125,8 @@ class Project(object): elif self.manifest.default.sync_c: current_branch_only = True - if not self.sync_tags: - tags = False + if tags is None: + tags = self.sync_tags if self.clone_depth: depth = self.clone_depth diff --git a/repo b/repo index 4068b127..f17c8a6f 100755 --- a/repo +++ b/repo @@ -327,8 +327,11 @@ def InitParser(parser, gitc_init=False): group.add_option('--no-current-branch', dest='current_branch_only', action='store_false', help='fetch all manifest branches from server') + group.add_option('--tags', + action='store_true', + help='fetch tags in the manifest') group.add_option('--no-tags', - dest='tags', default=True, action='store_false', + dest='tags', action='store_false', help="don't fetch tags in the manifest") # These are fundamentally different ways of structuring the checkout. diff --git a/subcmds/sync.py b/subcmds/sync.py index f06c61c5..e5280865 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py @@ -234,8 +234,11 @@ later is required to fix a server side protocol bug. help='fetch submodules from server') p.add_option('--use-superproject', action='store_true', help='use the manifest superproject to sync projects') + p.add_option('--tags', + action='store_false', + help='fetch tags') p.add_option('--no-tags', - dest='tags', default=True, action='store_false', + dest='tags', action='store_false', help="don't fetch tags") p.add_option('--optimized-fetch', dest='optimized_fetch', action='store_true',