diff options
author | Mike Frysinger <vapier@google.com> | 2021-07-26 15:59:20 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@google.com> | 2021-07-31 11:39:35 +0000 |
commit | df8b1cba47fc29d045efceec8cbb43b9182acbbb (patch) | |
tree | a22e54c9a800d083720b74123590a4fedf42f9f0 /command.py | |
parent | 9122bfc3a80367ed303e8e2d3b3b3d7a8851c904 (diff) | |
download | git-repo-df8b1cba47fc29d045efceec8cbb43b9182acbbb.tar.gz |
man: make output system independent
The current help output might change based on the number of CPU cores
available (since it reflects the dynamic --jobs logic). This is good
for users running repo locally, but not good for shipping static man
pages. Hook the help output to have it generate the same output all
the time.
Change-Id: I3098ceddc0ad914b0b8e3b25d660b5a264cb41ee
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/312882
Reviewed-by: Roger Shimizu <rosh@debian.org>
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'command.py')
-rw-r--r-- | command.py | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -24,6 +24,10 @@ from error import InvalidProjectGroupsError | |||
24 | import progress | 24 | import progress |
25 | 25 | ||
26 | 26 | ||
27 | # Are we generating man-pages? | ||
28 | GENERATE_MANPAGES = os.environ.get('_REPO_GENERATE_MANPAGES_') == ' indeed! ' | ||
29 | |||
30 | |||
27 | # Number of projects to submit to a single worker process at a time. | 31 | # Number of projects to submit to a single worker process at a time. |
28 | # This number represents a tradeoff between the overhead of IPC and finer | 32 | # This number represents a tradeoff between the overhead of IPC and finer |
29 | # grained opportunity for parallelism. This particular value was chosen by | 33 | # grained opportunity for parallelism. This particular value was chosen by |
@@ -122,10 +126,14 @@ class Command(object): | |||
122 | help='only show errors') | 126 | help='only show errors') |
123 | 127 | ||
124 | if self.PARALLEL_JOBS is not None: | 128 | if self.PARALLEL_JOBS is not None: |
129 | default = 'based on number of CPU cores' | ||
130 | if not GENERATE_MANPAGES: | ||
131 | # Only include active cpu count if we aren't generating man pages. | ||
132 | default = f'%default; {default}' | ||
125 | p.add_option( | 133 | p.add_option( |
126 | '-j', '--jobs', | 134 | '-j', '--jobs', |
127 | type=int, default=self.PARALLEL_JOBS, | 135 | type=int, default=self.PARALLEL_JOBS, |
128 | help='number of jobs to run in parallel (default: %s)' % self.PARALLEL_JOBS) | 136 | help=f'number of jobs to run in parallel (default: {default})') |
129 | 137 | ||
130 | def _Options(self, p): | 138 | def _Options(self, p): |
131 | """Initialize the option parser with subcommand-specific options.""" | 139 | """Initialize the option parser with subcommand-specific options.""" |