mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
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:
parent
5ba2120362
commit
4f21054c28
@ -43,11 +43,15 @@ class Command(object):
|
|||||||
"""Base class for any command line action in repo.
|
"""Base class for any command line action in repo.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
common = False
|
|
||||||
event_log = EventLog()
|
event_log = EventLog()
|
||||||
manifest = None
|
manifest = None
|
||||||
_optparse = 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,
|
# Whether this command supports running in parallel. If greater than 0,
|
||||||
# it is the number of parallel jobs to default to.
|
# it is the number of parallel jobs to default to.
|
||||||
PARALLEL_JOBS = None
|
PARALLEL_JOBS = None
|
||||||
|
@ -23,7 +23,7 @@ from progress import Progress
|
|||||||
|
|
||||||
|
|
||||||
class Abandon(Command):
|
class Abandon(Command):
|
||||||
common = True
|
COMMON = True
|
||||||
helpSummary = "Permanently abandon a development branch"
|
helpSummary = "Permanently abandon a development branch"
|
||||||
helpUsage = """
|
helpUsage = """
|
||||||
%prog [--all | <branchname>] [<project>...]
|
%prog [--all | <branchname>] [<project>...]
|
||||||
|
@ -62,7 +62,7 @@ class BranchInfo(object):
|
|||||||
|
|
||||||
|
|
||||||
class Branches(Command):
|
class Branches(Command):
|
||||||
common = True
|
COMMON = True
|
||||||
helpSummary = "View current topic branches"
|
helpSummary = "View current topic branches"
|
||||||
helpUsage = """
|
helpUsage = """
|
||||||
%prog [<project>...]
|
%prog [<project>...]
|
||||||
|
@ -20,7 +20,7 @@ from progress import Progress
|
|||||||
|
|
||||||
|
|
||||||
class Checkout(Command):
|
class Checkout(Command):
|
||||||
common = True
|
COMMON = True
|
||||||
helpSummary = "Checkout a branch for development"
|
helpSummary = "Checkout a branch for development"
|
||||||
helpUsage = """
|
helpUsage = """
|
||||||
%prog <branchname> [<project>...]
|
%prog <branchname> [<project>...]
|
||||||
|
@ -21,7 +21,7 @@ CHANGE_ID_RE = re.compile(r'^\s*Change-Id: I([0-9a-f]{40})\s*$')
|
|||||||
|
|
||||||
|
|
||||||
class CherryPick(Command):
|
class CherryPick(Command):
|
||||||
common = True
|
COMMON = True
|
||||||
helpSummary = "Cherry-pick a change."
|
helpSummary = "Cherry-pick a change."
|
||||||
helpUsage = """
|
helpUsage = """
|
||||||
%prog <sha1>
|
%prog <sha1>
|
||||||
|
@ -19,7 +19,7 @@ from command import DEFAULT_LOCAL_JOBS, PagedCommand
|
|||||||
|
|
||||||
|
|
||||||
class Diff(PagedCommand):
|
class Diff(PagedCommand):
|
||||||
common = True
|
COMMON = True
|
||||||
helpSummary = "Show changes between commit and working tree"
|
helpSummary = "Show changes between commit and working tree"
|
||||||
helpUsage = """
|
helpUsage = """
|
||||||
%prog [<project>...]
|
%prog [<project>...]
|
||||||
|
@ -31,7 +31,7 @@ class Diffmanifests(PagedCommand):
|
|||||||
deeper level.
|
deeper level.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
common = True
|
COMMON = True
|
||||||
helpSummary = "Manifest diff utility"
|
helpSummary = "Manifest diff utility"
|
||||||
helpUsage = """%prog manifest1.xml [manifest2.xml] [options]"""
|
helpUsage = """%prog manifest1.xml [manifest2.xml] [options]"""
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ CHANGE_RE = re.compile(r'^([1-9][0-9]*)(?:[/\.-]([1-9][0-9]*))?$')
|
|||||||
|
|
||||||
|
|
||||||
class Download(Command):
|
class Download(Command):
|
||||||
common = True
|
COMMON = True
|
||||||
helpSummary = "Download and checkout a change"
|
helpSummary = "Download and checkout a change"
|
||||||
helpUsage = """
|
helpUsage = """
|
||||||
%prog {[project] change[/patchset]}...
|
%prog {[project] change[/patchset]}...
|
||||||
|
@ -41,7 +41,7 @@ class ForallColoring(Coloring):
|
|||||||
|
|
||||||
|
|
||||||
class Forall(Command, MirrorSafeCommand):
|
class Forall(Command, MirrorSafeCommand):
|
||||||
common = False
|
COMMON = False
|
||||||
helpSummary = "Run a shell command in each project"
|
helpSummary = "Run a shell command in each project"
|
||||||
helpUsage = """
|
helpUsage = """
|
||||||
%prog [<project>...] -c <command> [<arg>...]
|
%prog [<project>...] -c <command> [<arg>...]
|
||||||
|
@ -19,7 +19,7 @@ import platform_utils
|
|||||||
|
|
||||||
|
|
||||||
class GitcDelete(Command, GitcClientCommand):
|
class GitcDelete(Command, GitcClientCommand):
|
||||||
common = True
|
COMMON = True
|
||||||
visible_everywhere = False
|
visible_everywhere = False
|
||||||
helpSummary = "Delete a GITC Client."
|
helpSummary = "Delete a GITC Client."
|
||||||
helpUsage = """
|
helpUsage = """
|
||||||
|
@ -23,7 +23,7 @@ import wrapper
|
|||||||
|
|
||||||
|
|
||||||
class GitcInit(init.Init, GitcAvailableCommand):
|
class GitcInit(init.Init, GitcAvailableCommand):
|
||||||
common = True
|
COMMON = True
|
||||||
helpSummary = "Initialize a GITC Client."
|
helpSummary = "Initialize a GITC Client."
|
||||||
helpUsage = """
|
helpUsage = """
|
||||||
%prog [options] [client name]
|
%prog [options] [client name]
|
||||||
|
@ -29,7 +29,7 @@ class GrepColoring(Coloring):
|
|||||||
|
|
||||||
|
|
||||||
class Grep(PagedCommand):
|
class Grep(PagedCommand):
|
||||||
common = True
|
COMMON = True
|
||||||
helpSummary = "Print lines matching a pattern"
|
helpSummary = "Print lines matching a pattern"
|
||||||
helpUsage = """
|
helpUsage = """
|
||||||
%prog {pattern | -e pattern} [<project>...]
|
%prog {pattern | -e pattern} [<project>...]
|
||||||
|
@ -24,7 +24,7 @@ from wrapper import Wrapper
|
|||||||
|
|
||||||
|
|
||||||
class Help(PagedCommand, MirrorSafeCommand):
|
class Help(PagedCommand, MirrorSafeCommand):
|
||||||
common = False
|
COMMON = False
|
||||||
helpSummary = "Display detailed help on a command"
|
helpSummary = "Display detailed help on a command"
|
||||||
helpUsage = """
|
helpUsage = """
|
||||||
%prog [--all|command]
|
%prog [--all|command]
|
||||||
@ -73,7 +73,7 @@ Displays detailed usage information about a command.
|
|||||||
|
|
||||||
commandNames = list(sorted([name
|
commandNames = list(sorted([name
|
||||||
for name, command in all_commands.items()
|
for name, command in all_commands.items()
|
||||||
if command.common and gitc_supported(command)]))
|
if command.COMMON and gitc_supported(command)]))
|
||||||
self._PrintCommands(commandNames)
|
self._PrintCommands(commandNames)
|
||||||
|
|
||||||
print(
|
print(
|
||||||
|
@ -25,7 +25,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 [-c]] [<project>...]"
|
helpUsage = "%prog [-dl] [-o [-c]] [<project>...]"
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ from wrapper import Wrapper
|
|||||||
|
|
||||||
|
|
||||||
class Init(InteractiveCommand, MirrorSafeCommand):
|
class Init(InteractiveCommand, MirrorSafeCommand):
|
||||||
common = True
|
COMMON = True
|
||||||
helpSummary = "Initialize a repo client checkout in the current directory"
|
helpSummary = "Initialize a repo client checkout in the current directory"
|
||||||
helpUsage = """
|
helpUsage = """
|
||||||
%prog [options] [manifest url]
|
%prog [options] [manifest url]
|
||||||
|
@ -16,7 +16,7 @@ from command import Command, MirrorSafeCommand
|
|||||||
|
|
||||||
|
|
||||||
class List(Command, MirrorSafeCommand):
|
class List(Command, MirrorSafeCommand):
|
||||||
common = True
|
COMMON = True
|
||||||
helpSummary = "List projects and their associated directories"
|
helpSummary = "List projects and their associated directories"
|
||||||
helpUsage = """
|
helpUsage = """
|
||||||
%prog [-f] [<project>...]
|
%prog [-f] [<project>...]
|
||||||
|
@ -20,7 +20,7 @@ from command import PagedCommand
|
|||||||
|
|
||||||
|
|
||||||
class Manifest(PagedCommand):
|
class Manifest(PagedCommand):
|
||||||
common = False
|
COMMON = False
|
||||||
helpSummary = "Manifest inspection utility"
|
helpSummary = "Manifest inspection utility"
|
||||||
helpUsage = """
|
helpUsage = """
|
||||||
%prog [-o {-|NAME.xml}] [-m MANIFEST.xml] [-r]
|
%prog [-o {-|NAME.xml}] [-m MANIFEST.xml] [-r]
|
||||||
|
@ -19,7 +19,7 @@ from command import PagedCommand
|
|||||||
|
|
||||||
|
|
||||||
class Overview(PagedCommand):
|
class Overview(PagedCommand):
|
||||||
common = True
|
COMMON = True
|
||||||
helpSummary = "Display overview of unmerged project branches"
|
helpSummary = "Display overview of unmerged project branches"
|
||||||
helpUsage = """
|
helpUsage = """
|
||||||
%prog [--current-branch] [<project>...]
|
%prog [--current-branch] [<project>...]
|
||||||
|
@ -19,7 +19,7 @@ from command import DEFAULT_LOCAL_JOBS, PagedCommand
|
|||||||
|
|
||||||
|
|
||||||
class Prune(PagedCommand):
|
class Prune(PagedCommand):
|
||||||
common = True
|
COMMON = True
|
||||||
helpSummary = "Prune (delete) already merged topics"
|
helpSummary = "Prune (delete) already merged topics"
|
||||||
helpUsage = """
|
helpUsage = """
|
||||||
%prog [<project>...]
|
%prog [<project>...]
|
||||||
|
@ -27,7 +27,7 @@ class RebaseColoring(Coloring):
|
|||||||
|
|
||||||
|
|
||||||
class Rebase(Command):
|
class Rebase(Command):
|
||||||
common = True
|
COMMON = True
|
||||||
helpSummary = "Rebase local branches on upstream branch"
|
helpSummary = "Rebase local branches on upstream branch"
|
||||||
helpUsage = """
|
helpUsage = """
|
||||||
%prog {[<project>...] | -i <project>...}
|
%prog {[<project>...] | -i <project>...}
|
||||||
|
@ -21,7 +21,7 @@ from subcmds.sync import _PostRepoFetch
|
|||||||
|
|
||||||
|
|
||||||
class Selfupdate(Command, MirrorSafeCommand):
|
class Selfupdate(Command, MirrorSafeCommand):
|
||||||
common = False
|
COMMON = False
|
||||||
helpSummary = "Update repo to the latest version"
|
helpSummary = "Update repo to the latest version"
|
||||||
helpUsage = """
|
helpUsage = """
|
||||||
%prog
|
%prog
|
||||||
|
@ -16,7 +16,7 @@ from subcmds.sync import Sync
|
|||||||
|
|
||||||
|
|
||||||
class Smartsync(Sync):
|
class Smartsync(Sync):
|
||||||
common = True
|
COMMON = True
|
||||||
helpSummary = "Update working tree to the latest known good revision"
|
helpSummary = "Update working tree to the latest known good revision"
|
||||||
helpUsage = """
|
helpUsage = """
|
||||||
%prog [<project>...]
|
%prog [<project>...]
|
||||||
|
@ -28,7 +28,7 @@ class _ProjectList(Coloring):
|
|||||||
|
|
||||||
|
|
||||||
class Stage(InteractiveCommand):
|
class Stage(InteractiveCommand):
|
||||||
common = True
|
COMMON = True
|
||||||
helpSummary = "Stage file(s) for commit"
|
helpSummary = "Stage file(s) for commit"
|
||||||
helpUsage = """
|
helpUsage = """
|
||||||
%prog -i [<project>...]
|
%prog -i [<project>...]
|
||||||
|
@ -25,7 +25,7 @@ from project import SyncBuffer
|
|||||||
|
|
||||||
|
|
||||||
class Start(Command):
|
class Start(Command):
|
||||||
common = True
|
COMMON = True
|
||||||
helpSummary = "Start a new branch for development"
|
helpSummary = "Start a new branch for development"
|
||||||
helpUsage = """
|
helpUsage = """
|
||||||
%prog <newbranchname> [--all | <project>...]
|
%prog <newbranchname> [--all | <project>...]
|
||||||
|
@ -24,7 +24,7 @@ import platform_utils
|
|||||||
|
|
||||||
|
|
||||||
class Status(PagedCommand):
|
class Status(PagedCommand):
|
||||||
common = True
|
COMMON = True
|
||||||
helpSummary = "Show the working tree status"
|
helpSummary = "Show the working tree status"
|
||||||
helpUsage = """
|
helpUsage = """
|
||||||
%prog [<project>...]
|
%prog [<project>...]
|
||||||
|
@ -66,7 +66,7 @@ _ONE_DAY_S = 24 * 60 * 60
|
|||||||
|
|
||||||
class Sync(Command, MirrorSafeCommand):
|
class Sync(Command, MirrorSafeCommand):
|
||||||
jobs = 1
|
jobs = 1
|
||||||
common = True
|
COMMON = True
|
||||||
helpSummary = "Update working tree to the latest revision"
|
helpSummary = "Update working tree to the latest revision"
|
||||||
helpUsage = """
|
helpUsage = """
|
||||||
%prog [<project>...]
|
%prog [<project>...]
|
||||||
|
@ -55,7 +55,7 @@ def _SplitEmails(values):
|
|||||||
|
|
||||||
|
|
||||||
class Upload(InteractiveCommand):
|
class Upload(InteractiveCommand):
|
||||||
common = True
|
COMMON = True
|
||||||
helpSummary = "Upload changes for code review"
|
helpSummary = "Upload changes for code review"
|
||||||
helpUsage = """
|
helpUsage = """
|
||||||
%prog [--re --cc] [<project>]...
|
%prog [--re --cc] [<project>]...
|
||||||
|
@ -25,7 +25,7 @@ class Version(Command, MirrorSafeCommand):
|
|||||||
wrapper_version = None
|
wrapper_version = None
|
||||||
wrapper_path = None
|
wrapper_path = None
|
||||||
|
|
||||||
common = False
|
COMMON = False
|
||||||
helpSummary = "Display the version of repo"
|
helpSummary = "Display the version of repo"
|
||||||
helpUsage = """
|
helpUsage = """
|
||||||
%prog
|
%prog
|
||||||
|
Loading…
Reference in New Issue
Block a user