Merge lp:~jelmer/bzr/bzr.1-generate-environment-section into lp:bzr

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: no longer in the source branch.
Merged at revision: 6509
Proposed branch: lp:~jelmer/bzr/bzr.1-generate-environment-section
Merge into: lp:bzr
Diff against target: 162 lines (+53/-56) (has conflicts)
3 files modified
bzrlib/doc_generate/autodoc_man.py (+11/-24)
bzrlib/help_topics/__init__.py (+36/-32)
doc/en/release-notes/bzr-2.6.txt (+6/-0)
Text conflict in doc/en/release-notes/bzr-2.6.txt
To merge this branch: bzr merge lp:~jelmer/bzr/bzr.1-generate-environment-section
Reviewer Review Type Date Requested Status
Vincent Ladeuil Approve
Review via email: mp+97691@code.launchpad.net

This proposal supersedes a proposal from 2012-03-14.

Commit message

Generate environment variables section in bzr(1) from standard list of environment variables.

Description of the change

Generate list of environment variables under ENVIRONMENT section in the manpage from the same list that is used to generate the 'bzr help env-topics' topic.

Now with ordering preserved.

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote : Posted in a previous version of this proposal

I'd be tempted to use a list of 2-tuples to preserve order rather than a dict and sorting it, which would split up BZR_EMAIL and EMAIL, for instance. Should probably also think about opening these to translation, though not in this branch.

Revision history for this message
Jelmer Vernooij (jelmer) wrote : Posted in a previous version of this proposal

Hmm, fair enough. I guess if we're doing tuples we might as well include something to filter out the lines not relevant on the current platform.

Revision history for this message
Vincent Ladeuil (vila) wrote :

I have a vague feeling that env vars related to config options should be documented there (and also discouraged since they can't be used on windows but that's quite out of scope for this proposal).

That being said, this is a significant step in the right direction so please proceed to the launchpad (fixing the conflicts and while you're there if you could think of at least one test to start rolling the ball, please do ;) and land.

review: Approve
Revision history for this message
Martin Packman (gz) wrote :

I like the idea of making it a 3-tuple with set([None, 'posix', 'nt']) for defining bit and displaying only if `t[2] in (None, os.name)` or similar.

Some mini tests for the layout function?

+ ret.append("=" * max_key_len + " " + "=" * desc_len + "\n")
...
+ ret += "=" * max_key_len + " " + "=" * desc_len + "\n"

One of these lines is not like the other. So, which adds one string of 80 characters, and which adds 80 strings of one character? :)

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bzrlib/doc_generate/autodoc_man.py'
--- bzrlib/doc_generate/autodoc_man.py 2012-03-14 18:11:34 +0000
+++ bzrlib/doc_generate/autodoc_man.py 2012-03-15 16:14:18 +0000
@@ -56,6 +56,7 @@
56 outfile.write(man_escape(man_head % params))56 outfile.write(man_escape(man_head % params))
57 outfile.write(man_escape(getcommand_list(params)))57 outfile.write(man_escape(getcommand_list(params)))
58 outfile.write(man_escape(getcommand_help(params)))58 outfile.write(man_escape(getcommand_help(params)))
59 outfile.write("".join(environment_variables()))
59 outfile.write(man_escape(man_foot % params))60 outfile.write(man_escape(man_foot % params))
6061
6162
@@ -171,6 +172,16 @@
171 return help172 return help
172173
173174
175def environment_variables():
176 yield ".SH \"ENVIRONMENT\"\n"
177
178 from bzrlib.help_topics import known_env_variables
179 for k, desc in known_env_variables:
180 yield ".TP\n"
181 yield ".I \"%s\"\n" % k
182 yield man_escape(desc) + "\n"
183
184
174man_preamble = """\185man_preamble = """\
175.\\\"Man page for Bazaar (%(bzrcmd)s)186.\\\"Man page for Bazaar (%(bzrcmd)s)
176.\\\"187.\\\"
@@ -215,30 +226,6 @@
215"""226"""
216227
217man_foot = """\228man_foot = """\
218.SH "ENVIRONMENT"
219.TP
220.I "BZRPATH"
221Path where
222.B "%(bzrcmd)s"
223is to look for shell plugin external commands.
224.TP
225.I "BZR_EMAIL"
226E-Mail address of the user. Overrides default user config.
227.TP
228.I "EMAIL"
229E-Mail address of the user. Overrides default user config.
230.TP
231.I "BZR_EDITOR"
232Editor for editing commit messages
233.TP
234.I "EDITOR"
235Editor for editing commit messages
236.TP
237.I "BZR_PLUGIN_PATH"
238Paths where bzr should look for plugins
239.TP
240.I "BZR_HOME"
241Home directory for bzr
242.SH "FILES"229.SH "FILES"
243.TP230.TP
244.I "~/.bazaar/bazaar.conf"231.I "~/.bazaar/bazaar.conf"
245232
=== modified file 'bzrlib/help_topics/__init__.py'
--- bzrlib/help_topics/__init__.py 2012-02-23 19:45:15 +0000
+++ bzrlib/help_topics/__init__.py 2012-03-15 16:14:18 +0000
@@ -595,38 +595,42 @@
595"""595"""
596596
597597
598_env_variables = \598known_env_variables = [
599"""Environment Variables599 ("BZRPATH", "Path where bzr is to look for shell plugin external commands."),
600600 ("BZR_EMAIL", "E-Mail address of the user. Overrides EMAIL."),
601=================== ===========================================================601 ("EMAIL", "E-Mail address of the user."),
602BZRPATH Path where bzr is to look for shell plugin external602 ("BZR_EDITOR", "Editor for editing commit messages. Overrides EDITOR."),
603 commands.603 ("EDITOR", "Editor for editing commit messages."),
604BZR_EMAIL E-Mail address of the user. Overrides EMAIL.604 ("BZR_PLUGIN_PATH", "Paths where bzr should look for plugins."),
605EMAIL E-Mail address of the user.605 ("BZR_DISABLE_PLUGINS", "Plugins that bzr should not load."),
606BZR_EDITOR Editor for editing commit messages. Overrides EDITOR.606 ("BZR_PLUGINS_AT", "Plugins to load from a directory not in BZR_PLUGIN_PATH."),
607EDITOR Editor for editing commit messages.607 ("BZR_HOME", "Directory holding .bazaar config dir. Overrides HOME."),
608BZR_PLUGIN_PATH Paths where bzr should look for plugins.608 ("BZR_HOME (Win32)", "Directory holding bazaar config dir. Overrides APPDATA and HOME."),
609BZR_DISABLE_PLUGINS Plugins that bzr should not load.609 ("BZR_REMOTE_PATH", "Full name of remote 'bzr' command (for bzr+ssh:// URLs)."),
610BZR_PLUGINS_AT Plugins to load from a directory not in BZR_PLUGIN_PATH.610 ("BZR_SSH", "Path to SSH client, or one of paramiko, openssh, sshcorp, plink or lsh."),
611BZR_HOME Directory holding .bazaar config dir. Overrides HOME.611 ("BZR_LOG", "Location of .bzr.log (use '/dev/null' to suppress log)."),
612BZR_HOME (Win32) Directory holding bazaar config dir. Overrides APPDATA and612 ("BZR_LOG (Win32)", "Location of .bzr.log (use 'NUL' to suppress log)."),
613 HOME.613 ("BZR_COLUMNS", "Override implicit terminal width."),
614BZR_REMOTE_PATH Full name of remote 'bzr' command (for bzr+ssh:// URLs).614 ("BZR_CONCURRENCY", "Number of processes that can be run concurrently (selftest)"),
615BZR_SSH Path to SSH client, or one of paramiko, openssh, sshcorp,615 ("BZR_PROGRESS_BAR", "Override the progress display. Values are 'none' or 'text'."),
616 plink or lsh.616 ("BZR_PDB", "Control whether to launch a debugger on error."),
617BZR_LOG Location of .bzr.log (use '/dev/null' to suppress log).617 ("BZR_SIGQUIT_PDB", "Control whether SIGQUIT behaves normally or invokes a breakin debugger."),
618BZR_LOG (Win32) Location of .bzr.log (use 'NUL' to suppress log).618 ("BZR_TEXTUI_INPUT", "Force console input mode for prompts to line-based (instead of char-based)."),
619BZR_COLUMNS Override implicit terminal width.619 ]
620BZR_CONCURRENCY Number of processes that can be run concurrently (selftest)620
621BZR_PROGRESS_BAR Override the progress display. Values are 'none' or 'text'.621def _env_variables(topic):
622BZR_PDB Control whether to launch a debugger on error.622 import textwrap
623BZR_SIGQUIT_PDB Control whether SIGQUIT behaves normally or invokes a623 ret = ["Environment Variables\n\n"]
624 breakin debugger.624 max_key_len = max([len(k[0]) for k in known_env_variables])
625BZR_TEXTUI_INPUT Force console input mode for prompts to line-based (instead625 desc_len = (80 - max_key_len - 2)
626 of char-based).626 ret.append("=" * max_key_len + " " + "=" * desc_len + "\n")
627=================== ===========================================================627 for k, desc in known_env_variables:
628"""628 ret.append(k + (max_key_len + 1 - len(k)) * " ")
629629 ret.append("\n".join(textwrap.wrap(
630 desc, width=desc_len, subsequent_indent=" " * (max_key_len + 1))))
631 ret.append("\n")
632 ret += "=" * max_key_len + " " + "=" * desc_len + "\n"
633 return "".join(ret)
630634
631_files = \635_files = \
632r"""Files636r"""Files
633637
=== modified file 'doc/en/release-notes/bzr-2.6.txt'
--- doc/en/release-notes/bzr-2.6.txt 2012-03-15 15:09:48 +0000
+++ doc/en/release-notes/bzr-2.6.txt 2012-03-15 16:14:18 +0000
@@ -119,6 +119,7 @@
119119
120.. Improved or updated documentation.120.. Improved or updated documentation.
121121
122<<<<<<< TREE
122* Document "bzr lp-propose", "bzr register-branch" and123* Document "bzr lp-propose", "bzr register-branch" and
123 the other Launchpad plugin commands in bzr(1).124 the other Launchpad plugin commands in bzr(1).
124 (Jelmer Vernooij, #843801, #163995)125 (Jelmer Vernooij, #843801, #163995)
@@ -127,6 +128,11 @@
127 accidentally be interpreted as a roff macro in bzr(1).128 accidentally be interpreted as a roff macro in bzr(1).
128 (Jelmer Vernooij, #711079)129 (Jelmer Vernooij, #711079)
129130
131=======
132* Generate ``ENVIRONMENT`` section in bzr(1) from known environment variable
133 list rather than hardcoding. (Jelmer Vernooij, #197618)
134
135>>>>>>> MERGE-SOURCE
130* Properly format apostrophes in manual page. (Jelmer Vernooij, #234771)136* Properly format apostrophes in manual page. (Jelmer Vernooij, #234771)
131137
132API Changes138API Changes