summaryrefslogtreecommitdiffstats
path: root/subcmds/init.py
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2020-02-05 00:01:59 -0500
committerMike Frysinger <vapier@google.com>2020-02-05 16:00:10 +0000
commit66098f707a1a3f352aac4c4bb2c4f88da070ca2a (patch)
tree15c9fc56d88c232d0e2fbdcfb35f8176c0057fc8 /subcmds/init.py
parentf7b64e3350a622ee87e1927cdbc8d854a5696d85 (diff)
downloadgit-repo-66098f707a1a3f352aac4c4bb2c4f88da070ca2a.tar.gz
init: handle -c conflicts with gitc-init
We keep getting requests for init to support -c. This conflicts with gitc-init which allocates -c for its own use. Lets make this dynamic so we keep it with "init" but omit it for "gitc-init". Bug: https://crbug.com/gerrit/10200 Change-Id: Ibf69c2bbeff638e28e63cb08926fea0c622258db Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/253252 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'subcmds/init.py')
-rw-r--r--subcmds/init.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/subcmds/init.py b/subcmds/init.py
index 3e2c9d70..f4229f62 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -81,7 +81,7 @@ manifest, a subsequent `repo sync` (or `repo sync -d`) is necessary
81to update the working directory files. 81to update the working directory files.
82""" 82"""
83 83
84 def _Options(self, p): 84 def _Options(self, p, gitc_init=False):
85 # Logging 85 # Logging
86 g = p.add_option_group('Logging options') 86 g = p.add_option_group('Logging options')
87 g.add_option('-q', '--quiet', 87 g.add_option('-q', '--quiet',
@@ -96,7 +96,12 @@ to update the working directory files.
96 g.add_option('-b', '--manifest-branch', 96 g.add_option('-b', '--manifest-branch',
97 dest='manifest_branch', 97 dest='manifest_branch',
98 help='manifest branch or revision', metavar='REVISION') 98 help='manifest branch or revision', metavar='REVISION')
99 g.add_option('-c', '--current-branch', 99 cbr_opts = ['--current-branch']
100 # The gitc-init subcommand allocates -c itself, but a lot of init users
101 # want -c, so try to satisfy both as best we can.
102 if gitc_init:
103 cbr_opts += ['-c']
104 g.add_option(*cbr_opts,
100 dest='current_branch_only', action='store_true', 105 dest='current_branch_only', action='store_true',
101 help='fetch only current manifest branch from server') 106 help='fetch only current manifest branch from server')
102 g.add_option('-m', '--manifest-name', 107 g.add_option('-m', '--manifest-name',