commands: document the "common" class attribute

Switch it to uppercase to make it clear it's a constant, and add
documentation so its usage is clear.

Change-Id: I6d281a66a90b5908b3131585c9945e88cfe815ea
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/309322
Reviewed-by: Raman Tenneti <rtenneti@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
Mike Frysinger 2021-06-14 16:05:19 -04:00
parent 5ba2120362
commit 4f21054c28
28 changed files with 33 additions and 29 deletions

View File

@ -43,11 +43,15 @@ class Command(object):
"""Base class for any command line action in repo.
"""
common = False
event_log = EventLog()
manifest = None
_optparse = None
# Whether this command is a "common" one, i.e. whether the user would commonly
# use it or it's a more uncommon command. This is used by the help command to
# show short-vs-full summaries.
COMMON = False
# Whether this command supports running in parallel. If greater than 0,
# it is the number of parallel jobs to default to.
PARALLEL_JOBS = None

View File

@ -23,7 +23,7 @@ from progress import Progress
class Abandon(Command):
common = True
COMMON = True
helpSummary = "Permanently abandon a development branch"
helpUsage = """
%prog [--all | <branchname>] [<project>...]

View File

@ -62,7 +62,7 @@ class BranchInfo(object):
class Branches(Command):
common = True
COMMON = True
helpSummary = "View current topic branches"
helpUsage = """
%prog [<project>...]

View File

@ -20,7 +20,7 @@ from progress import Progress
class Checkout(Command):
common = True
COMMON = True
helpSummary = "Checkout a branch for development"
helpUsage = """
%prog <branchname> [<project>...]

View File

@ -21,7 +21,7 @@ CHANGE_ID_RE = re.compile(r'^\s*Change-Id: I([0-9a-f]{40})\s*$')
class CherryPick(Command):
common = True
COMMON = True
helpSummary = "Cherry-pick a change."
helpUsage = """
%prog <sha1>

View File

@ -19,7 +19,7 @@ from command import DEFAULT_LOCAL_JOBS, PagedCommand
class Diff(PagedCommand):
common = True
COMMON = True
helpSummary = "Show changes between commit and working tree"
helpUsage = """
%prog [<project>...]

View File

@ -31,7 +31,7 @@ class Diffmanifests(PagedCommand):
deeper level.
"""
common = True
COMMON = True
helpSummary = "Manifest diff utility"
helpUsage = """%prog manifest1.xml [manifest2.xml] [options]"""

View File

@ -22,7 +22,7 @@ CHANGE_RE = re.compile(r'^([1-9][0-9]*)(?:[/\.-]([1-9][0-9]*))?$')
class Download(Command):
common = True
COMMON = True
helpSummary = "Download and checkout a change"
helpUsage = """
%prog {[project] change[/patchset]}...

View File

@ -41,7 +41,7 @@ class ForallColoring(Coloring):
class Forall(Command, MirrorSafeCommand):
common = False
COMMON = False
helpSummary = "Run a shell command in each project"
helpUsage = """
%prog [<project>...] -c <command> [<arg>...]

View File

@ -19,7 +19,7 @@ import platform_utils
class GitcDelete(Command, GitcClientCommand):
common = True
COMMON = True
visible_everywhere = False
helpSummary = "Delete a GITC Client."
helpUsage = """

View File

@ -23,7 +23,7 @@ import wrapper
class GitcInit(init.Init, GitcAvailableCommand):
common = True
COMMON = True
helpSummary = "Initialize a GITC Client."
helpUsage = """
%prog [options] [client name]

View File

@ -29,7 +29,7 @@ class GrepColoring(Coloring):
class Grep(PagedCommand):
common = True
COMMON = True
helpSummary = "Print lines matching a pattern"
helpUsage = """
%prog {pattern | -e pattern} [<project>...]

View File

@ -24,7 +24,7 @@ from wrapper import Wrapper
class Help(PagedCommand, MirrorSafeCommand):
common = False
COMMON = False
helpSummary = "Display detailed help on a command"
helpUsage = """
%prog [--all|command]
@ -73,7 +73,7 @@ Displays detailed usage information about a command.
commandNames = list(sorted([name
for name, command in all_commands.items()
if command.common and gitc_supported(command)]))
if command.COMMON and gitc_supported(command)]))
self._PrintCommands(commandNames)
print(

View File

@ -25,7 +25,7 @@ class _Coloring(Coloring):
class Info(PagedCommand):
common = True
COMMON = True
helpSummary = "Get info on the manifest branch, current branch or unmerged branches"
helpUsage = "%prog [-dl] [-o [-c]] [<project>...]"

View File

@ -31,7 +31,7 @@ from wrapper import Wrapper
class Init(InteractiveCommand, MirrorSafeCommand):
common = True
COMMON = True
helpSummary = "Initialize a repo client checkout in the current directory"
helpUsage = """
%prog [options] [manifest url]

View File

@ -16,7 +16,7 @@ from command import Command, MirrorSafeCommand
class List(Command, MirrorSafeCommand):
common = True
COMMON = True
helpSummary = "List projects and their associated directories"
helpUsage = """
%prog [-f] [<project>...]

View File

@ -20,7 +20,7 @@ from command import PagedCommand
class Manifest(PagedCommand):
common = False
COMMON = False
helpSummary = "Manifest inspection utility"
helpUsage = """
%prog [-o {-|NAME.xml}] [-m MANIFEST.xml] [-r]

View File

@ -19,7 +19,7 @@ from command import PagedCommand
class Overview(PagedCommand):
common = True
COMMON = True
helpSummary = "Display overview of unmerged project branches"
helpUsage = """
%prog [--current-branch] [<project>...]

View File

@ -19,7 +19,7 @@ from command import DEFAULT_LOCAL_JOBS, PagedCommand
class Prune(PagedCommand):
common = True
COMMON = True
helpSummary = "Prune (delete) already merged topics"
helpUsage = """
%prog [<project>...]

View File

@ -27,7 +27,7 @@ class RebaseColoring(Coloring):
class Rebase(Command):
common = True
COMMON = True
helpSummary = "Rebase local branches on upstream branch"
helpUsage = """
%prog {[<project>...] | -i <project>...}

View File

@ -21,7 +21,7 @@ from subcmds.sync import _PostRepoFetch
class Selfupdate(Command, MirrorSafeCommand):
common = False
COMMON = False
helpSummary = "Update repo to the latest version"
helpUsage = """
%prog

View File

@ -16,7 +16,7 @@ from subcmds.sync import Sync
class Smartsync(Sync):
common = True
COMMON = True
helpSummary = "Update working tree to the latest known good revision"
helpUsage = """
%prog [<project>...]

View File

@ -28,7 +28,7 @@ class _ProjectList(Coloring):
class Stage(InteractiveCommand):
common = True
COMMON = True
helpSummary = "Stage file(s) for commit"
helpUsage = """
%prog -i [<project>...]

View File

@ -25,7 +25,7 @@ from project import SyncBuffer
class Start(Command):
common = True
COMMON = True
helpSummary = "Start a new branch for development"
helpUsage = """
%prog <newbranchname> [--all | <project>...]

View File

@ -24,7 +24,7 @@ import platform_utils
class Status(PagedCommand):
common = True
COMMON = True
helpSummary = "Show the working tree status"
helpUsage = """
%prog [<project>...]

View File

@ -66,7 +66,7 @@ _ONE_DAY_S = 24 * 60 * 60
class Sync(Command, MirrorSafeCommand):
jobs = 1
common = True
COMMON = True
helpSummary = "Update working tree to the latest revision"
helpUsage = """
%prog [<project>...]

View File

@ -55,7 +55,7 @@ def _SplitEmails(values):
class Upload(InteractiveCommand):
common = True
COMMON = True
helpSummary = "Upload changes for code review"
helpUsage = """
%prog [--re --cc] [<project>]...

View File

@ -25,7 +25,7 @@ class Version(Command, MirrorSafeCommand):
wrapper_version = None
wrapper_path = None
common = False
COMMON = False
helpSummary = "Display the version of repo"
helpUsage = """
%prog