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
1=== modified file 'bzrlib/doc_generate/autodoc_man.py'
2--- bzrlib/doc_generate/autodoc_man.py 2012-03-14 18:11:34 +0000
3+++ bzrlib/doc_generate/autodoc_man.py 2012-03-15 16:14:18 +0000
4@@ -56,6 +56,7 @@
5 outfile.write(man_escape(man_head % params))
6 outfile.write(man_escape(getcommand_list(params)))
7 outfile.write(man_escape(getcommand_help(params)))
8+ outfile.write("".join(environment_variables()))
9 outfile.write(man_escape(man_foot % params))
10
11
12@@ -171,6 +172,16 @@
13 return help
14
15
16+def environment_variables():
17+ yield ".SH \"ENVIRONMENT\"\n"
18+
19+ from bzrlib.help_topics import known_env_variables
20+ for k, desc in known_env_variables:
21+ yield ".TP\n"
22+ yield ".I \"%s\"\n" % k
23+ yield man_escape(desc) + "\n"
24+
25+
26 man_preamble = """\
27 .\\\"Man page for Bazaar (%(bzrcmd)s)
28 .\\\"
29@@ -215,30 +226,6 @@
30 """
31
32 man_foot = """\
33-.SH "ENVIRONMENT"
34-.TP
35-.I "BZRPATH"
36-Path where
37-.B "%(bzrcmd)s"
38-is to look for shell plugin external commands.
39-.TP
40-.I "BZR_EMAIL"
41-E-Mail address of the user. Overrides default user config.
42-.TP
43-.I "EMAIL"
44-E-Mail address of the user. Overrides default user config.
45-.TP
46-.I "BZR_EDITOR"
47-Editor for editing commit messages
48-.TP
49-.I "EDITOR"
50-Editor for editing commit messages
51-.TP
52-.I "BZR_PLUGIN_PATH"
53-Paths where bzr should look for plugins
54-.TP
55-.I "BZR_HOME"
56-Home directory for bzr
57 .SH "FILES"
58 .TP
59 .I "~/.bazaar/bazaar.conf"
60
61=== modified file 'bzrlib/help_topics/__init__.py'
62--- bzrlib/help_topics/__init__.py 2012-02-23 19:45:15 +0000
63+++ bzrlib/help_topics/__init__.py 2012-03-15 16:14:18 +0000
64@@ -595,38 +595,42 @@
65 """
66
67
68-_env_variables = \
69-"""Environment Variables
70-
71-=================== ===========================================================
72-BZRPATH Path where bzr is to look for shell plugin external
73- commands.
74-BZR_EMAIL E-Mail address of the user. Overrides EMAIL.
75-EMAIL E-Mail address of the user.
76-BZR_EDITOR Editor for editing commit messages. Overrides EDITOR.
77-EDITOR Editor for editing commit messages.
78-BZR_PLUGIN_PATH Paths where bzr should look for plugins.
79-BZR_DISABLE_PLUGINS Plugins that bzr should not load.
80-BZR_PLUGINS_AT Plugins to load from a directory not in BZR_PLUGIN_PATH.
81-BZR_HOME Directory holding .bazaar config dir. Overrides HOME.
82-BZR_HOME (Win32) Directory holding bazaar config dir. Overrides APPDATA and
83- HOME.
84-BZR_REMOTE_PATH Full name of remote 'bzr' command (for bzr+ssh:// URLs).
85-BZR_SSH Path to SSH client, or one of paramiko, openssh, sshcorp,
86- plink or lsh.
87-BZR_LOG Location of .bzr.log (use '/dev/null' to suppress log).
88-BZR_LOG (Win32) Location of .bzr.log (use 'NUL' to suppress log).
89-BZR_COLUMNS Override implicit terminal width.
90-BZR_CONCURRENCY Number of processes that can be run concurrently (selftest)
91-BZR_PROGRESS_BAR Override the progress display. Values are 'none' or 'text'.
92-BZR_PDB Control whether to launch a debugger on error.
93-BZR_SIGQUIT_PDB Control whether SIGQUIT behaves normally or invokes a
94- breakin debugger.
95-BZR_TEXTUI_INPUT Force console input mode for prompts to line-based (instead
96- of char-based).
97-=================== ===========================================================
98-"""
99-
100+known_env_variables = [
101+ ("BZRPATH", "Path where bzr is to look for shell plugin external commands."),
102+ ("BZR_EMAIL", "E-Mail address of the user. Overrides EMAIL."),
103+ ("EMAIL", "E-Mail address of the user."),
104+ ("BZR_EDITOR", "Editor for editing commit messages. Overrides EDITOR."),
105+ ("EDITOR", "Editor for editing commit messages."),
106+ ("BZR_PLUGIN_PATH", "Paths where bzr should look for plugins."),
107+ ("BZR_DISABLE_PLUGINS", "Plugins that bzr should not load."),
108+ ("BZR_PLUGINS_AT", "Plugins to load from a directory not in BZR_PLUGIN_PATH."),
109+ ("BZR_HOME", "Directory holding .bazaar config dir. Overrides HOME."),
110+ ("BZR_HOME (Win32)", "Directory holding bazaar config dir. Overrides APPDATA and HOME."),
111+ ("BZR_REMOTE_PATH", "Full name of remote 'bzr' command (for bzr+ssh:// URLs)."),
112+ ("BZR_SSH", "Path to SSH client, or one of paramiko, openssh, sshcorp, plink or lsh."),
113+ ("BZR_LOG", "Location of .bzr.log (use '/dev/null' to suppress log)."),
114+ ("BZR_LOG (Win32)", "Location of .bzr.log (use 'NUL' to suppress log)."),
115+ ("BZR_COLUMNS", "Override implicit terminal width."),
116+ ("BZR_CONCURRENCY", "Number of processes that can be run concurrently (selftest)"),
117+ ("BZR_PROGRESS_BAR", "Override the progress display. Values are 'none' or 'text'."),
118+ ("BZR_PDB", "Control whether to launch a debugger on error."),
119+ ("BZR_SIGQUIT_PDB", "Control whether SIGQUIT behaves normally or invokes a breakin debugger."),
120+ ("BZR_TEXTUI_INPUT", "Force console input mode for prompts to line-based (instead of char-based)."),
121+ ]
122+
123+def _env_variables(topic):
124+ import textwrap
125+ ret = ["Environment Variables\n\n"]
126+ max_key_len = max([len(k[0]) for k in known_env_variables])
127+ desc_len = (80 - max_key_len - 2)
128+ ret.append("=" * max_key_len + " " + "=" * desc_len + "\n")
129+ for k, desc in known_env_variables:
130+ ret.append(k + (max_key_len + 1 - len(k)) * " ")
131+ ret.append("\n".join(textwrap.wrap(
132+ desc, width=desc_len, subsequent_indent=" " * (max_key_len + 1))))
133+ ret.append("\n")
134+ ret += "=" * max_key_len + " " + "=" * desc_len + "\n"
135+ return "".join(ret)
136
137 _files = \
138 r"""Files
139
140=== modified file 'doc/en/release-notes/bzr-2.6.txt'
141--- doc/en/release-notes/bzr-2.6.txt 2012-03-15 15:09:48 +0000
142+++ doc/en/release-notes/bzr-2.6.txt 2012-03-15 16:14:18 +0000
143@@ -119,6 +119,7 @@
144
145 .. Improved or updated documentation.
146
147+<<<<<<< TREE
148 * Document "bzr lp-propose", "bzr register-branch" and
149 the other Launchpad plugin commands in bzr(1).
150 (Jelmer Vernooij, #843801, #163995)
151@@ -127,6 +128,11 @@
152 accidentally be interpreted as a roff macro in bzr(1).
153 (Jelmer Vernooij, #711079)
154
155+=======
156+* Generate ``ENVIRONMENT`` section in bzr(1) from known environment variable
157+ list rather than hardcoding. (Jelmer Vernooij, #197618)
158+
159+>>>>>>> MERGE-SOURCE
160 * Properly format apostrophes in manual page. (Jelmer Vernooij, #234771)
161
162 API Changes