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

Proposed by Jelmer Vernooij
Status: Superseded
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
bzr-core Pending
Review via email: mp+97451@code.launchpad.net

This proposal has been superseded by a proposal from 2012-03-15.

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.

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

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 :

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.

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 15:40:25 +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 15:40:25 +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 15:40:25 +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