summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2021-05-03 00:51:52 -0400
committerMike Frysinger <vapier@google.com>2021-05-03 16:57:23 +0000
commitb8e09ea1d6e8051697da52db1291e8267844e206 (patch)
treed708bf68be5f7d5f644290b4b5f4f2797d30568c
parentfeb28914bd17aacc2d251516e504a33f991f86c4 (diff)
downloadgit-repo-b8e09ea1d6e8051697da52db1291e8267844e206.tar.gz
harmonize --current-branch short option across subcommands
We're inconsistent with the short option for this flag: * gitc-init: <none as -c is already used> * info: -b * init: -c * overview: -b * sync: -c * upload: --cbr Since info & overview are not as heavily used as the others, switch them from -b to -c. We leave -b in as a hidden alias for now. Similarly, switch upload from --cbr to just -c. A lot of people use --cbr, so we leave this as a hidden alias for now too. Ideally gitc-init wouldn't use -c, but that ship has sailed, and we're more likely to deprecate gitc entirely at this point. This provides a consistent set of options across subcommands. Bug: https://crbug.com/gerrit/12401 Change-Id: Iec249729223866fe1ea0ebabed12ca851cc38b35 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/304902 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
-rw-r--r--subcmds/info.py10
-rw-r--r--subcmds/overview.py10
-rw-r--r--subcmds/upload.py7
3 files changed, 22 insertions, 5 deletions
diff --git a/subcmds/info.py b/subcmds/info.py
index 6381fa8e..8e017ed8 100644
--- a/subcmds/info.py
+++ b/subcmds/info.py
@@ -12,6 +12,8 @@
12# See the License for the specific language governing permissions and 12# See the License for the specific language governing permissions and
13# limitations under the License. 13# limitations under the License.
14 14
15import optparse
16
15from command import PagedCommand 17from command import PagedCommand
16from color import Coloring 18from color import Coloring
17from git_refs import R_M, R_HEADS 19from git_refs import R_M, R_HEADS
@@ -25,7 +27,7 @@ class _Coloring(Coloring):
25class Info(PagedCommand): 27class Info(PagedCommand):
26 common = True 28 common = True
27 helpSummary = "Get info on the manifest branch, current branch or unmerged branches" 29 helpSummary = "Get info on the manifest branch, current branch or unmerged branches"
28 helpUsage = "%prog [-dl] [-o [-b]] [<project>...]" 30 helpUsage = "%prog [-dl] [-o [-c]] [<project>...]"
29 31
30 def _Options(self, p): 32 def _Options(self, p):
31 p.add_option('-d', '--diff', 33 p.add_option('-d', '--diff',
@@ -34,9 +36,13 @@ class Info(PagedCommand):
34 p.add_option('-o', '--overview', 36 p.add_option('-o', '--overview',
35 dest='overview', action='store_true', 37 dest='overview', action='store_true',
36 help='show overview of all local commits') 38 help='show overview of all local commits')
37 p.add_option('-b', '--current-branch', 39 p.add_option('-c', '--current-branch',
38 dest="current_branch", action="store_true", 40 dest="current_branch", action="store_true",
39 help="consider only checked out branches") 41 help="consider only checked out branches")
42 # Turn this into a warning & remove this someday.
43 p.add_option('-b',
44 dest='current_branch', action='store_true',
45 help=optparse.SUPPRESS_HELP)
40 p.add_option('-l', '--local-only', 46 p.add_option('-l', '--local-only',
41 dest="local", action="store_true", 47 dest="local", action="store_true",
42 help="Disable all remote operations") 48 help="Disable all remote operations")
diff --git a/subcmds/overview.py b/subcmds/overview.py
index 004a847c..4f62f94f 100644
--- a/subcmds/overview.py
+++ b/subcmds/overview.py
@@ -12,6 +12,8 @@
12# See the License for the specific language governing permissions and 12# See the License for the specific language governing permissions and
13# limitations under the License. 13# limitations under the License.
14 14
15import optparse
16
15from color import Coloring 17from color import Coloring
16from command import PagedCommand 18from command import PagedCommand
17 19
@@ -26,15 +28,19 @@ class Overview(PagedCommand):
26The '%prog' command is used to display an overview of the projects branches, 28The '%prog' command is used to display an overview of the projects branches,
27and list any local commits that have not yet been merged into the project. 29and list any local commits that have not yet been merged into the project.
28 30
29The -b/--current-branch option can be used to restrict the output to only 31The -c/--current-branch option can be used to restrict the output to only
30branches currently checked out in each project. By default, all branches 32branches currently checked out in each project. By default, all branches
31are displayed. 33are displayed.
32""" 34"""
33 35
34 def _Options(self, p): 36 def _Options(self, p):
35 p.add_option('-b', '--current-branch', 37 p.add_option('-c', '--current-branch',
36 dest="current_branch", action="store_true", 38 dest="current_branch", action="store_true",
37 help="Consider only checked out branches") 39 help="Consider only checked out branches")
40 # Turn this into a warning & remove this someday.
41 p.add_option('-b',
42 dest='current_branch', action='store_true',
43 help=optparse.SUPPRESS_HELP)
38 44
39 def Execute(self, opt, args): 45 def Execute(self, opt, args):
40 all_branches = [] 46 all_branches = []
diff --git a/subcmds/upload.py b/subcmds/upload.py
index 0dd0b7da..57434b18 100644
--- a/subcmds/upload.py
+++ b/subcmds/upload.py
@@ -14,6 +14,7 @@
14 14
15import copy 15import copy
16import functools 16import functools
17import optparse
17import re 18import re
18import sys 19import sys
19 20
@@ -170,9 +171,13 @@ Gerrit Code Review: https://www.gerritcodereview.com/
170 p.add_option('--br', '--branch', 171 p.add_option('--br', '--branch',
171 type='string', action='store', dest='branch', 172 type='string', action='store', dest='branch',
172 help='(Local) branch to upload.') 173 help='(Local) branch to upload.')
173 p.add_option('--cbr', '--current-branch', 174 p.add_option('-c', '--current-branch',
174 dest='current_branch', action='store_true', 175 dest='current_branch', action='store_true',
175 help='Upload current git branch.') 176 help='Upload current git branch.')
177 # Turn this into a warning & remove this someday.
178 p.add_option('--cbr',
179 dest='current_branch', action='store_true',
180 help=optparse.SUPPRESS_HELP)
176 p.add_option('--ne', '--no-emails', 181 p.add_option('--ne', '--no-emails',
177 action='store_false', dest='notify', default=True, 182 action='store_false', dest='notify', default=True,
178 help='If specified, do not send emails on upload.') 183 help='If specified, do not send emails on upload.')