diff options
author | Mike Frysinger <vapier@google.com> | 2021-06-14 16:05:19 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@google.com> | 2021-06-15 06:07:37 +0000 |
commit | 4f21054c2841809da5e1e600b1cc765811288a80 (patch) | |
tree | 326156bb4407124de07207847bd9e4587124e37d | |
parent | 5ba2120362ceb49b89e0536108792fd7c824e28a (diff) | |
download | git-repo-4f21054c2841809da5e1e600b1cc765811288a80.tar.gz |
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>
-rw-r--r-- | command.py | 6 | ||||
-rw-r--r-- | subcmds/abandon.py | 2 | ||||
-rw-r--r-- | subcmds/branches.py | 2 | ||||
-rw-r--r-- | subcmds/checkout.py | 2 | ||||
-rw-r--r-- | subcmds/cherry_pick.py | 2 | ||||
-rw-r--r-- | subcmds/diff.py | 2 | ||||
-rw-r--r-- | subcmds/diffmanifests.py | 2 | ||||
-rw-r--r-- | subcmds/download.py | 2 | ||||
-rw-r--r-- | subcmds/forall.py | 2 | ||||
-rw-r--r-- | subcmds/gitc_delete.py | 2 | ||||
-rw-r--r-- | subcmds/gitc_init.py | 2 | ||||
-rw-r--r-- | subcmds/grep.py | 2 | ||||
-rw-r--r-- | subcmds/help.py | 4 | ||||
-rw-r--r-- | subcmds/info.py | 2 | ||||
-rw-r--r-- | subcmds/init.py | 2 | ||||
-rw-r--r-- | subcmds/list.py | 2 | ||||
-rw-r--r-- | subcmds/manifest.py | 2 | ||||
-rw-r--r-- | subcmds/overview.py | 2 | ||||
-rw-r--r-- | subcmds/prune.py | 2 | ||||
-rw-r--r-- | subcmds/rebase.py | 2 | ||||
-rw-r--r-- | subcmds/selfupdate.py | 2 | ||||
-rw-r--r-- | subcmds/smartsync.py | 2 | ||||
-rw-r--r-- | subcmds/stage.py | 2 | ||||
-rw-r--r-- | subcmds/start.py | 2 | ||||
-rw-r--r-- | subcmds/status.py | 2 | ||||
-rw-r--r-- | subcmds/sync.py | 2 | ||||
-rw-r--r-- | subcmds/upload.py | 2 | ||||
-rw-r--r-- | subcmds/version.py | 2 |
28 files changed, 33 insertions, 29 deletions
@@ -43,11 +43,15 @@ class Command(object): | |||
43 | """Base class for any command line action in repo. | 43 | """Base class for any command line action in repo. |
44 | """ | 44 | """ |
45 | 45 | ||
46 | common = False | ||
47 | event_log = EventLog() | 46 | event_log = EventLog() |
48 | manifest = None | 47 | manifest = None |
49 | _optparse = None | 48 | _optparse = None |
50 | 49 | ||
50 | # Whether this command is a "common" one, i.e. whether the user would commonly | ||
51 | # use it or it's a more uncommon command. This is used by the help command to | ||
52 | # show short-vs-full summaries. | ||
53 | COMMON = False | ||
54 | |||
51 | # Whether this command supports running in parallel. If greater than 0, | 55 | # Whether this command supports running in parallel. If greater than 0, |
52 | # it is the number of parallel jobs to default to. | 56 | # it is the number of parallel jobs to default to. |
53 | PARALLEL_JOBS = None | 57 | PARALLEL_JOBS = None |
diff --git a/subcmds/abandon.py b/subcmds/abandon.py index c7c127d6..85d85f5a 100644 --- a/subcmds/abandon.py +++ b/subcmds/abandon.py | |||
@@ -23,7 +23,7 @@ from progress import Progress | |||
23 | 23 | ||
24 | 24 | ||
25 | class Abandon(Command): | 25 | class Abandon(Command): |
26 | common = True | 26 | COMMON = True |
27 | helpSummary = "Permanently abandon a development branch" | 27 | helpSummary = "Permanently abandon a development branch" |
28 | helpUsage = """ | 28 | helpUsage = """ |
29 | %prog [--all | <branchname>] [<project>...] | 29 | %prog [--all | <branchname>] [<project>...] |
diff --git a/subcmds/branches.py b/subcmds/branches.py index 2dc102bb..6d975ed4 100644 --- a/subcmds/branches.py +++ b/subcmds/branches.py | |||
@@ -62,7 +62,7 @@ class BranchInfo(object): | |||
62 | 62 | ||
63 | 63 | ||
64 | class Branches(Command): | 64 | class Branches(Command): |
65 | common = True | 65 | COMMON = True |
66 | helpSummary = "View current topic branches" | 66 | helpSummary = "View current topic branches" |
67 | helpUsage = """ | 67 | helpUsage = """ |
68 | %prog [<project>...] | 68 | %prog [<project>...] |
diff --git a/subcmds/checkout.py b/subcmds/checkout.py index 4d8009b1..9b429489 100644 --- a/subcmds/checkout.py +++ b/subcmds/checkout.py | |||
@@ -20,7 +20,7 @@ from progress import Progress | |||
20 | 20 | ||
21 | 21 | ||
22 | class Checkout(Command): | 22 | class Checkout(Command): |
23 | common = True | 23 | COMMON = True |
24 | helpSummary = "Checkout a branch for development" | 24 | helpSummary = "Checkout a branch for development" |
25 | helpUsage = """ | 25 | helpUsage = """ |
26 | %prog <branchname> [<project>...] | 26 | %prog <branchname> [<project>...] |
diff --git a/subcmds/cherry_pick.py b/subcmds/cherry_pick.py index fc4998c3..7bd858bf 100644 --- a/subcmds/cherry_pick.py +++ b/subcmds/cherry_pick.py | |||
@@ -21,7 +21,7 @@ CHANGE_ID_RE = re.compile(r'^\s*Change-Id: I([0-9a-f]{40})\s*$') | |||
21 | 21 | ||
22 | 22 | ||
23 | class CherryPick(Command): | 23 | class CherryPick(Command): |
24 | common = True | 24 | COMMON = True |
25 | helpSummary = "Cherry-pick a change." | 25 | helpSummary = "Cherry-pick a change." |
26 | helpUsage = """ | 26 | helpUsage = """ |
27 | %prog <sha1> | 27 | %prog <sha1> |
diff --git a/subcmds/diff.py b/subcmds/diff.py index b400ccfd..00a7ec29 100644 --- a/subcmds/diff.py +++ b/subcmds/diff.py | |||
@@ -19,7 +19,7 @@ from command import DEFAULT_LOCAL_JOBS, PagedCommand | |||
19 | 19 | ||
20 | 20 | ||
21 | class Diff(PagedCommand): | 21 | class Diff(PagedCommand): |
22 | common = True | 22 | COMMON = True |
23 | helpSummary = "Show changes between commit and working tree" | 23 | helpSummary = "Show changes between commit and working tree" |
24 | helpUsage = """ | 24 | helpUsage = """ |
25 | %prog [<project>...] | 25 | %prog [<project>...] |
diff --git a/subcmds/diffmanifests.py b/subcmds/diffmanifests.py index 6f23b345..f6cc30a2 100644 --- a/subcmds/diffmanifests.py +++ b/subcmds/diffmanifests.py | |||
@@ -31,7 +31,7 @@ class Diffmanifests(PagedCommand): | |||
31 | deeper level. | 31 | deeper level. |
32 | """ | 32 | """ |
33 | 33 | ||
34 | common = True | 34 | COMMON = True |
35 | helpSummary = "Manifest diff utility" | 35 | helpSummary = "Manifest diff utility" |
36 | helpUsage = """%prog manifest1.xml [manifest2.xml] [options]""" | 36 | helpUsage = """%prog manifest1.xml [manifest2.xml] [options]""" |
37 | 37 | ||
diff --git a/subcmds/download.py b/subcmds/download.py index 81d997e0..523f25e0 100644 --- a/subcmds/download.py +++ b/subcmds/download.py | |||
@@ -22,7 +22,7 @@ CHANGE_RE = re.compile(r'^([1-9][0-9]*)(?:[/\.-]([1-9][0-9]*))?$') | |||
22 | 22 | ||
23 | 23 | ||
24 | class Download(Command): | 24 | class Download(Command): |
25 | common = True | 25 | COMMON = True |
26 | helpSummary = "Download and checkout a change" | 26 | helpSummary = "Download and checkout a change" |
27 | helpUsage = """ | 27 | helpUsage = """ |
28 | %prog {[project] change[/patchset]}... | 28 | %prog {[project] change[/patchset]}... |
diff --git a/subcmds/forall.py b/subcmds/forall.py index 0cf3b6a6..7c1dea9e 100644 --- a/subcmds/forall.py +++ b/subcmds/forall.py | |||
@@ -41,7 +41,7 @@ class ForallColoring(Coloring): | |||
41 | 41 | ||
42 | 42 | ||
43 | class Forall(Command, MirrorSafeCommand): | 43 | class Forall(Command, MirrorSafeCommand): |
44 | common = False | 44 | COMMON = False |
45 | helpSummary = "Run a shell command in each project" | 45 | helpSummary = "Run a shell command in each project" |
46 | helpUsage = """ | 46 | helpUsage = """ |
47 | %prog [<project>...] -c <command> [<arg>...] | 47 | %prog [<project>...] -c <command> [<arg>...] |
diff --git a/subcmds/gitc_delete.py b/subcmds/gitc_delete.py index 54b956f7..df749469 100644 --- a/subcmds/gitc_delete.py +++ b/subcmds/gitc_delete.py | |||
@@ -19,7 +19,7 @@ import platform_utils | |||
19 | 19 | ||
20 | 20 | ||
21 | class GitcDelete(Command, GitcClientCommand): | 21 | class GitcDelete(Command, GitcClientCommand): |
22 | common = True | 22 | COMMON = True |
23 | visible_everywhere = False | 23 | visible_everywhere = False |
24 | helpSummary = "Delete a GITC Client." | 24 | helpSummary = "Delete a GITC Client." |
25 | helpUsage = """ | 25 | helpUsage = """ |
diff --git a/subcmds/gitc_init.py b/subcmds/gitc_init.py index 23a4ebb6..e705b613 100644 --- a/subcmds/gitc_init.py +++ b/subcmds/gitc_init.py | |||
@@ -23,7 +23,7 @@ import wrapper | |||
23 | 23 | ||
24 | 24 | ||
25 | class GitcInit(init.Init, GitcAvailableCommand): | 25 | class GitcInit(init.Init, GitcAvailableCommand): |
26 | common = True | 26 | COMMON = True |
27 | helpSummary = "Initialize a GITC Client." | 27 | helpSummary = "Initialize a GITC Client." |
28 | helpUsage = """ | 28 | helpUsage = """ |
29 | %prog [options] [client name] | 29 | %prog [options] [client name] |
diff --git a/subcmds/grep.py b/subcmds/grep.py index 6cb1445a..8ac4ba14 100644 --- a/subcmds/grep.py +++ b/subcmds/grep.py | |||
@@ -29,7 +29,7 @@ class GrepColoring(Coloring): | |||
29 | 29 | ||
30 | 30 | ||
31 | class Grep(PagedCommand): | 31 | class Grep(PagedCommand): |
32 | common = True | 32 | COMMON = True |
33 | helpSummary = "Print lines matching a pattern" | 33 | helpSummary = "Print lines matching a pattern" |
34 | helpUsage = """ | 34 | helpUsage = """ |
35 | %prog {pattern | -e pattern} [<project>...] | 35 | %prog {pattern | -e pattern} [<project>...] |
diff --git a/subcmds/help.py b/subcmds/help.py index 0989b999..821f6bf6 100644 --- a/subcmds/help.py +++ b/subcmds/help.py | |||
@@ -24,7 +24,7 @@ from wrapper import Wrapper | |||
24 | 24 | ||
25 | 25 | ||
26 | class Help(PagedCommand, MirrorSafeCommand): | 26 | class Help(PagedCommand, MirrorSafeCommand): |
27 | common = False | 27 | COMMON = False |
28 | helpSummary = "Display detailed help on a command" | 28 | helpSummary = "Display detailed help on a command" |
29 | helpUsage = """ | 29 | helpUsage = """ |
30 | %prog [--all|command] | 30 | %prog [--all|command] |
@@ -73,7 +73,7 @@ Displays detailed usage information about a command. | |||
73 | 73 | ||
74 | commandNames = list(sorted([name | 74 | commandNames = list(sorted([name |
75 | for name, command in all_commands.items() | 75 | for name, command in all_commands.items() |
76 | if command.common and gitc_supported(command)])) | 76 | if command.COMMON and gitc_supported(command)])) |
77 | self._PrintCommands(commandNames) | 77 | self._PrintCommands(commandNames) |
78 | 78 | ||
79 | print( | 79 | print( |
diff --git a/subcmds/info.py b/subcmds/info.py index f7cf60fc..6c1246ef 100644 --- a/subcmds/info.py +++ b/subcmds/info.py | |||
@@ -25,7 +25,7 @@ class _Coloring(Coloring): | |||
25 | 25 | ||
26 | 26 | ||
27 | class Info(PagedCommand): | 27 | class Info(PagedCommand): |
28 | common = True | 28 | COMMON = True |
29 | 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" |
30 | helpUsage = "%prog [-dl] [-o [-c]] [<project>...]" | 30 | helpUsage = "%prog [-dl] [-o [-c]] [<project>...]" |
31 | 31 | ||
diff --git a/subcmds/init.py b/subcmds/init.py index 4182262e..750facba 100644 --- a/subcmds/init.py +++ b/subcmds/init.py | |||
@@ -31,7 +31,7 @@ from wrapper import Wrapper | |||
31 | 31 | ||
32 | 32 | ||
33 | class Init(InteractiveCommand, MirrorSafeCommand): | 33 | class Init(InteractiveCommand, MirrorSafeCommand): |
34 | common = True | 34 | COMMON = True |
35 | helpSummary = "Initialize a repo client checkout in the current directory" | 35 | helpSummary = "Initialize a repo client checkout in the current directory" |
36 | helpUsage = """ | 36 | helpUsage = """ |
37 | %prog [options] [manifest url] | 37 | %prog [options] [manifest url] |
diff --git a/subcmds/list.py b/subcmds/list.py index 68bcd5e0..8d0c5640 100644 --- a/subcmds/list.py +++ b/subcmds/list.py | |||
@@ -16,7 +16,7 @@ from command import Command, MirrorSafeCommand | |||
16 | 16 | ||
17 | 17 | ||
18 | class List(Command, MirrorSafeCommand): | 18 | class List(Command, MirrorSafeCommand): |
19 | common = True | 19 | COMMON = True |
20 | helpSummary = "List projects and their associated directories" | 20 | helpSummary = "List projects and their associated directories" |
21 | helpUsage = """ | 21 | helpUsage = """ |
22 | %prog [-f] [<project>...] | 22 | %prog [-f] [<project>...] |
diff --git a/subcmds/manifest.py b/subcmds/manifest.py index 965c36e9..00587d8d 100644 --- a/subcmds/manifest.py +++ b/subcmds/manifest.py | |||
@@ -20,7 +20,7 @@ from command import PagedCommand | |||
20 | 20 | ||
21 | 21 | ||
22 | class Manifest(PagedCommand): | 22 | class Manifest(PagedCommand): |
23 | common = False | 23 | COMMON = False |
24 | helpSummary = "Manifest inspection utility" | 24 | helpSummary = "Manifest inspection utility" |
25 | helpUsage = """ | 25 | helpUsage = """ |
26 | %prog [-o {-|NAME.xml}] [-m MANIFEST.xml] [-r] | 26 | %prog [-o {-|NAME.xml}] [-m MANIFEST.xml] [-r] |
diff --git a/subcmds/overview.py b/subcmds/overview.py index b28367be..63f5a79e 100644 --- a/subcmds/overview.py +++ b/subcmds/overview.py | |||
@@ -19,7 +19,7 @@ from command import PagedCommand | |||
19 | 19 | ||
20 | 20 | ||
21 | class Overview(PagedCommand): | 21 | class Overview(PagedCommand): |
22 | common = True | 22 | COMMON = True |
23 | helpSummary = "Display overview of unmerged project branches" | 23 | helpSummary = "Display overview of unmerged project branches" |
24 | helpUsage = """ | 24 | helpUsage = """ |
25 | %prog [--current-branch] [<project>...] | 25 | %prog [--current-branch] [<project>...] |
diff --git a/subcmds/prune.py b/subcmds/prune.py index 236b647f..584ee7ed 100644 --- a/subcmds/prune.py +++ b/subcmds/prune.py | |||
@@ -19,7 +19,7 @@ from command import DEFAULT_LOCAL_JOBS, PagedCommand | |||
19 | 19 | ||
20 | 20 | ||
21 | class Prune(PagedCommand): | 21 | class Prune(PagedCommand): |
22 | common = True | 22 | COMMON = True |
23 | helpSummary = "Prune (delete) already merged topics" | 23 | helpSummary = "Prune (delete) already merged topics" |
24 | helpUsage = """ | 24 | helpUsage = """ |
25 | %prog [<project>...] | 25 | %prog [<project>...] |
diff --git a/subcmds/rebase.py b/subcmds/rebase.py index 9ce4ecb8..7c53eb7a 100644 --- a/subcmds/rebase.py +++ b/subcmds/rebase.py | |||
@@ -27,7 +27,7 @@ class RebaseColoring(Coloring): | |||
27 | 27 | ||
28 | 28 | ||
29 | class Rebase(Command): | 29 | class Rebase(Command): |
30 | common = True | 30 | COMMON = True |
31 | helpSummary = "Rebase local branches on upstream branch" | 31 | helpSummary = "Rebase local branches on upstream branch" |
32 | helpUsage = """ | 32 | helpUsage = """ |
33 | %prog {[<project>...] | -i <project>...} | 33 | %prog {[<project>...] | -i <project>...} |
diff --git a/subcmds/selfupdate.py b/subcmds/selfupdate.py index 388881d9..282f518e 100644 --- a/subcmds/selfupdate.py +++ b/subcmds/selfupdate.py | |||
@@ -21,7 +21,7 @@ from subcmds.sync import _PostRepoFetch | |||
21 | 21 | ||
22 | 22 | ||
23 | class Selfupdate(Command, MirrorSafeCommand): | 23 | class Selfupdate(Command, MirrorSafeCommand): |
24 | common = False | 24 | COMMON = False |
25 | helpSummary = "Update repo to the latest version" | 25 | helpSummary = "Update repo to the latest version" |
26 | helpUsage = """ | 26 | helpUsage = """ |
27 | %prog | 27 | %prog |
diff --git a/subcmds/smartsync.py b/subcmds/smartsync.py index c7d1d4d4..d91d59c6 100644 --- a/subcmds/smartsync.py +++ b/subcmds/smartsync.py | |||
@@ -16,7 +16,7 @@ from subcmds.sync import Sync | |||
16 | 16 | ||
17 | 17 | ||
18 | class Smartsync(Sync): | 18 | class Smartsync(Sync): |
19 | common = True | 19 | COMMON = True |
20 | helpSummary = "Update working tree to the latest known good revision" | 20 | helpSummary = "Update working tree to the latest known good revision" |
21 | helpUsage = """ | 21 | helpUsage = """ |
22 | %prog [<project>...] | 22 | %prog [<project>...] |
diff --git a/subcmds/stage.py b/subcmds/stage.py index ff0f1738..0389a4ff 100644 --- a/subcmds/stage.py +++ b/subcmds/stage.py | |||
@@ -28,7 +28,7 @@ class _ProjectList(Coloring): | |||
28 | 28 | ||
29 | 29 | ||
30 | class Stage(InteractiveCommand): | 30 | class Stage(InteractiveCommand): |
31 | common = True | 31 | COMMON = True |
32 | helpSummary = "Stage file(s) for commit" | 32 | helpSummary = "Stage file(s) for commit" |
33 | helpUsage = """ | 33 | helpUsage = """ |
34 | %prog -i [<project>...] | 34 | %prog -i [<project>...] |
diff --git a/subcmds/start.py b/subcmds/start.py index ff2bae56..2addaf2e 100644 --- a/subcmds/start.py +++ b/subcmds/start.py | |||
@@ -25,7 +25,7 @@ from project import SyncBuffer | |||
25 | 25 | ||
26 | 26 | ||
27 | class Start(Command): | 27 | class Start(Command): |
28 | common = True | 28 | COMMON = True |
29 | helpSummary = "Start a new branch for development" | 29 | helpSummary = "Start a new branch for development" |
30 | helpUsage = """ | 30 | helpUsage = """ |
31 | %prog <newbranchname> [--all | <project>...] | 31 | %prog <newbranchname> [--all | <project>...] |
diff --git a/subcmds/status.py b/subcmds/status.py index 1b48dcea..5b669547 100644 --- a/subcmds/status.py +++ b/subcmds/status.py | |||
@@ -24,7 +24,7 @@ import platform_utils | |||
24 | 24 | ||
25 | 25 | ||
26 | class Status(PagedCommand): | 26 | class Status(PagedCommand): |
27 | common = True | 27 | COMMON = True |
28 | helpSummary = "Show the working tree status" | 28 | helpSummary = "Show the working tree status" |
29 | helpUsage = """ | 29 | helpUsage = """ |
30 | %prog [<project>...] | 30 | %prog [<project>...] |
diff --git a/subcmds/sync.py b/subcmds/sync.py index 67d9c115..b15d9477 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -66,7 +66,7 @@ _ONE_DAY_S = 24 * 60 * 60 | |||
66 | 66 | ||
67 | class Sync(Command, MirrorSafeCommand): | 67 | class Sync(Command, MirrorSafeCommand): |
68 | jobs = 1 | 68 | jobs = 1 |
69 | common = True | 69 | COMMON = True |
70 | helpSummary = "Update working tree to the latest revision" | 70 | helpSummary = "Update working tree to the latest revision" |
71 | helpUsage = """ | 71 | helpUsage = """ |
72 | %prog [<project>...] | 72 | %prog [<project>...] |
diff --git a/subcmds/upload.py b/subcmds/upload.py index fc389e42..c48deab6 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py | |||
@@ -55,7 +55,7 @@ def _SplitEmails(values): | |||
55 | 55 | ||
56 | 56 | ||
57 | class Upload(InteractiveCommand): | 57 | class Upload(InteractiveCommand): |
58 | common = True | 58 | COMMON = True |
59 | helpSummary = "Upload changes for code review" | 59 | helpSummary = "Upload changes for code review" |
60 | helpUsage = """ | 60 | helpUsage = """ |
61 | %prog [--re --cc] [<project>]... | 61 | %prog [--re --cc] [<project>]... |
diff --git a/subcmds/version.py b/subcmds/version.py index 1d9abb58..09b053ea 100644 --- a/subcmds/version.py +++ b/subcmds/version.py | |||
@@ -25,7 +25,7 @@ class Version(Command, MirrorSafeCommand): | |||
25 | wrapper_version = None | 25 | wrapper_version = None |
26 | wrapper_path = None | 26 | wrapper_path = None |
27 | 27 | ||
28 | common = False | 28 | COMMON = False |
29 | helpSummary = "Display the version of repo" | 29 | helpSummary = "Display the version of repo" |
30 | helpUsage = """ | 30 | helpUsage = """ |
31 | %prog | 31 | %prog |