mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
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>
This commit is contained in:
parent
feb28914bd
commit
b8e09ea1d6
@ -12,6 +12,8 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
import optparse
|
||||||
|
|
||||||
from command import PagedCommand
|
from command import PagedCommand
|
||||||
from color import Coloring
|
from color import Coloring
|
||||||
from git_refs import R_M, R_HEADS
|
from git_refs import R_M, R_HEADS
|
||||||
@ -25,7 +27,7 @@ class _Coloring(Coloring):
|
|||||||
class Info(PagedCommand):
|
class Info(PagedCommand):
|
||||||
common = True
|
common = True
|
||||||
helpSummary = "Get info on the manifest branch, current branch or unmerged branches"
|
helpSummary = "Get info on the manifest branch, current branch or unmerged branches"
|
||||||
helpUsage = "%prog [-dl] [-o [-b]] [<project>...]"
|
helpUsage = "%prog [-dl] [-o [-c]] [<project>...]"
|
||||||
|
|
||||||
def _Options(self, p):
|
def _Options(self, p):
|
||||||
p.add_option('-d', '--diff',
|
p.add_option('-d', '--diff',
|
||||||
@ -34,9 +36,13 @@ class Info(PagedCommand):
|
|||||||
p.add_option('-o', '--overview',
|
p.add_option('-o', '--overview',
|
||||||
dest='overview', action='store_true',
|
dest='overview', action='store_true',
|
||||||
help='show overview of all local commits')
|
help='show overview of all local commits')
|
||||||
p.add_option('-b', '--current-branch',
|
p.add_option('-c', '--current-branch',
|
||||||
dest="current_branch", action="store_true",
|
dest="current_branch", action="store_true",
|
||||||
help="consider only checked out branches")
|
help="consider only checked out branches")
|
||||||
|
# Turn this into a warning & remove this someday.
|
||||||
|
p.add_option('-b',
|
||||||
|
dest='current_branch', action='store_true',
|
||||||
|
help=optparse.SUPPRESS_HELP)
|
||||||
p.add_option('-l', '--local-only',
|
p.add_option('-l', '--local-only',
|
||||||
dest="local", action="store_true",
|
dest="local", action="store_true",
|
||||||
help="Disable all remote operations")
|
help="Disable all remote operations")
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
import optparse
|
||||||
|
|
||||||
from color import Coloring
|
from color import Coloring
|
||||||
from command import PagedCommand
|
from command import PagedCommand
|
||||||
|
|
||||||
@ -26,15 +28,19 @@ class Overview(PagedCommand):
|
|||||||
The '%prog' command is used to display an overview of the projects branches,
|
The '%prog' command is used to display an overview of the projects branches,
|
||||||
and list any local commits that have not yet been merged into the project.
|
and list any local commits that have not yet been merged into the project.
|
||||||
|
|
||||||
The -b/--current-branch option can be used to restrict the output to only
|
The -c/--current-branch option can be used to restrict the output to only
|
||||||
branches currently checked out in each project. By default, all branches
|
branches currently checked out in each project. By default, all branches
|
||||||
are displayed.
|
are displayed.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def _Options(self, p):
|
def _Options(self, p):
|
||||||
p.add_option('-b', '--current-branch',
|
p.add_option('-c', '--current-branch',
|
||||||
dest="current_branch", action="store_true",
|
dest="current_branch", action="store_true",
|
||||||
help="Consider only checked out branches")
|
help="Consider only checked out branches")
|
||||||
|
# Turn this into a warning & remove this someday.
|
||||||
|
p.add_option('-b',
|
||||||
|
dest='current_branch', action='store_true',
|
||||||
|
help=optparse.SUPPRESS_HELP)
|
||||||
|
|
||||||
def Execute(self, opt, args):
|
def Execute(self, opt, args):
|
||||||
all_branches = []
|
all_branches = []
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
import functools
|
import functools
|
||||||
|
import optparse
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -170,9 +171,13 @@ Gerrit Code Review: https://www.gerritcodereview.com/
|
|||||||
p.add_option('--br', '--branch',
|
p.add_option('--br', '--branch',
|
||||||
type='string', action='store', dest='branch',
|
type='string', action='store', dest='branch',
|
||||||
help='(Local) branch to upload.')
|
help='(Local) branch to upload.')
|
||||||
p.add_option('--cbr', '--current-branch',
|
p.add_option('-c', '--current-branch',
|
||||||
dest='current_branch', action='store_true',
|
dest='current_branch', action='store_true',
|
||||||
help='Upload current git branch.')
|
help='Upload current git branch.')
|
||||||
|
# Turn this into a warning & remove this someday.
|
||||||
|
p.add_option('--cbr',
|
||||||
|
dest='current_branch', action='store_true',
|
||||||
|
help=optparse.SUPPRESS_HELP)
|
||||||
p.add_option('--ne', '--no-emails',
|
p.add_option('--ne', '--no-emails',
|
||||||
action='store_false', dest='notify', default=True,
|
action='store_false', dest='notify', default=True,
|
||||||
help='If specified, do not send emails on upload.')
|
help='If specified, do not send emails on upload.')
|
||||||
|
Loading…
Reference in New Issue
Block a user