21
21
* add command aliases
24
from __future__ import absolute_import
26
PLUGINS_TO_DOCUMENT = ["launchpad"]
31
import bzrlib.help_topics
32
import bzrlib.commands
33
import brzlib.help_topics
34
import brzlib.commands
37
from brzlib.plugin import load_plugins
35
41
def get_filename(options):
40
46
def infogen(options, outfile):
41
47
"""Assembles a man page"""
48
tt = brzlib.osutils.gmtime()
45
50
{ "bzrcmd": options.bzr_name,
46
51
"datestamp": time.strftime("%Y-%m-%d",tt),
47
52
"timestamp": time.strftime("%Y-%m-%d %H:%M:%S +0000",tt),
48
"version": bzrlib.__version__,
53
"version": brzlib.__version__,
50
55
outfile.write(man_preamble % params)
51
56
outfile.write(man_escape(man_head % params))
52
57
outfile.write(man_escape(getcommand_list(params)))
53
58
outfile.write(man_escape(getcommand_help(params)))
59
outfile.write("".join(environment_variables()))
54
60
outfile.write(man_escape(man_foot % params))
57
63
def man_escape(string):
58
64
"""Escapes strings for man page compatibility"""
59
65
result = string.replace("\\","\\\\")
60
result = result.replace("`","\\`")
61
result = result.replace("'","\\'")
66
result = result.replace("`","\\'")
67
result = result.replace("'","\\*(Aq")
62
68
result = result.replace("-","\\-")
66
72
def command_name_list():
67
"""Builds a list of command names from bzrlib"""
68
command_names = bzrlib.commands.builtin_command_names()
73
"""Builds a list of command names from brzlib"""
74
command_names = brzlib.commands.builtin_command_names()
75
for cmdname in brzlib.commands.plugin_command_names():
76
cmd_object = brzlib.commands.get_cmd_object(cmdname)
77
if (PLUGINS_TO_DOCUMENT is None or
78
cmd_object.plugin_name() in PLUGINS_TO_DOCUMENT):
79
command_names.append(cmdname)
69
80
command_names.sort()
70
81
return command_names
75
86
bzrcmd = params["bzrcmd"]
76
87
output = '.SH "COMMAND OVERVIEW"\n'
77
88
for cmd_name in command_name_list():
78
cmd_object = bzrlib.commands.get_cmd_object(cmd_name)
89
cmd_object = brzlib.commands.get_cmd_object(cmd_name)
79
90
if cmd_object.hidden:
81
92
cmd_help = cmd_object.help()
94
105
output='.SH "COMMAND REFERENCE"\n'
96
107
for cmd_name in command_name_list():
97
cmd_object = bzrlib.commands.get_cmd_object(cmd_name)
108
cmd_object = brzlib.commands.get_cmd_object(cmd_name)
98
109
if cmd_object.hidden:
100
111
formatted[cmd_name] = format_command(params, cmd_object)
108
def format_command (params, cmd):
119
def format_command(params, cmd):
109
120
"""Provides long help for each public command"""
110
121
subsection_header = '.SS "%s"\n' % (cmd._usage())
111
122
doc = "%s\n" % (cmd.__doc__)
112
doc = bzrlib.help_topics.help_as_plain_text(cmd.help())
123
doc = brzlib.help_topics.help_as_plain_text(cmd.help())
125
# A dot at the beginning of a line is interpreted as a macro.
126
# Simply join lines that begin with a dot with the previous
127
# line to work around this.
128
doc = doc.replace("\n.", ".")
115
131
options = cmd.options()
175
def environment_variables():
176
yield ".SH \"ENVIRONMENT\"\n"
178
from brzlib.help_topics import known_env_variables
179
for k, desc in known_env_variables:
181
yield ".I \"%s\"\n" % k
182
yield man_escape(desc) + "\n"
159
185
man_preamble = """\
160
186
.\\\"Man page for Bazaar (%(bzrcmd)s)
188
215
.SH "DESCRIPTION"
189
Bazaar (or %(bzrcmd)s) is a project of Canonical to develop an open source
190
distributed version control system that is powerful, friendly, and scalable.
191
Version control means a system that keeps track of previous revisions
192
of software source code or similar information and helps people work on it in teams.
217
Bazaar (or %(bzrcmd)s) is a distributed version control system that is powerful,
218
friendly, and scalable. Bazaar is a project of Canonical Ltd and part of
219
the GNU Project to develop a free operating system.
221
Bazaar keeps track of changes to software source code (or similar information);
222
lets you explore who changed it, when, and why; merges concurrent changes; and
223
helps people work together in a team.
201
is to look for shell plugin external commands.
204
E-Mail address of the user. Overrides default user config.
207
E-Mail address of the user. Overrides default user config.
210
Editor for editing commit messages
213
Editor for editing commit messages
216
Paths where bzr should look for plugins
219
Home directory for bzr
222
229
.I "~/.bazaar/bazaar.conf"
242
249
log10 = log --short -r -10..-1
244
.UR http://www.bazaar.canonical.com/
245
.BR http://www.bazaar.canonical.com/
251
.UR http://bazaar.canonical.com/
252
.BR http://bazaar.canonical.com/