summaryrefslogtreecommitdiffstats
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 18:04:11 +0000
commit75c02fe4cb5a22135e292c3083220e1f3d4cb349 (patch)
tree230fd74540982039b71ef623945eab3cada76d3e
parentafd1b4023f3b96a845ffec997359ab6ede46e6a2 (diff)
downloadgit-repo-75c02fe4cb5a22135e292c3083220e1f3d4cb349.tar.gz
init: handle -c conflicts with gitc-initv1.13.9.2
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 (cherry picked from commit 66098f707a1a3f352aac4c4bb2c4f88da070ca2a) Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/253392 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
-rw-r--r--subcmds/gitc_init.py2
-rw-r--r--subcmds/init.py9
2 files changed, 8 insertions, 3 deletions
diff --git a/subcmds/gitc_init.py b/subcmds/gitc_init.py
index df7b2587..378f9236 100644
--- a/subcmds/gitc_init.py
+++ b/subcmds/gitc_init.py
@@ -50,7 +50,7 @@ use for this GITC client.
50""" 50"""
51 51
52 def _Options(self, p): 52 def _Options(self, p):
53 super(GitcInit, self)._Options(p) 53 super(GitcInit, self)._Options(p, gitc_init=True)
54 g = p.add_option_group('GITC options') 54 g = p.add_option_group('GITC options')
55 g.add_option('-f', '--manifest-file', 55 g.add_option('-f', '--manifest-file',
56 dest='manifest_file', 56 dest='manifest_file',
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',