~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to tools/doc_generate/autodoc_man.py

  • Committer: Andrew Bennetts
  • Date: 2007-03-26 06:24:01 UTC
  • mto: This revision was merged to the branch mainline in revision 2376.
  • Revision ID: andrew.bennetts@canonical.com-20070326062401-k3nbefzje5332jaf
Deal with review comments from Robert:

  * Add my name to the NEWS file
  * Move the test case to a new module in branch_implementations
  * Remove revision_history cruft from identitymap and test_identitymap
  * Improve some docstrings

Also, this fixes a bug where revision_history was not returning a copy of the
cached data, allowing the cache to be corrupted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 
29
29
import bzrlib
30
30
import bzrlib.help
31
 
import bzrlib.help_topics
32
31
import bzrlib.commands
33
32
 
34
33
 
81
80
        cmd_help = cmd_object.help()
82
81
        if cmd_help:
83
82
            firstline = cmd_help.split('\n', 1)[0]
84
 
            usage = cmd_object._usage()
 
83
            usage = bzrlib.help.command_usage(cmd_object)
85
84
            tmp = '.TP\n.B "%s"\n%s\n' % (usage, firstline)
86
85
            output = output + tmp
87
86
        else:
102
101
 
103
102
def format_command (params, cmd):
104
103
    """Provides long help for each public command"""
105
 
    subsection_header = '.SS "%s"\n' % (cmd._usage())
 
104
    subsection_header = '.SS "%s"\n' % (bzrlib.help.command_usage(cmd))
106
105
    doc = "%s\n" % (cmd.__doc__)
107
 
    doc = bzrlib.help_topics.help_as_plain_text(cmd.help())
 
106
    doc = cmd.help()
108
107
 
109
108
    option_str = ""
110
109
    options = cmd.options()
112
111
        option_str = "\nOptions:\n"
113
112
        for option_name, option in sorted(options.items()):
114
113
            for name, short_name, argname, help in option.iter_switches():
115
 
                if option.is_hidden(name):
116
 
                    continue
117
114
                l = '    --' + name
118
115
                if argname is not None:
119
116
                    l += ' ' + argname
134
131
        aliases_str += ', '.join(cmd.aliases)
135
132
        aliases_str += '\n'
136
133
 
137
 
    see_also_str = ""
138
 
    see_also = cmd.get_see_also()
139
 
    if see_also:
140
 
        see_also_str += '\nSee also: '
141
 
        see_also_str += ', '.join(see_also)
142
 
        see_also_str += '\n'
143
 
 
144
 
    return subsection_header + option_str + aliases_str + see_also_str + "\n" + doc + "\n"
 
134
    return subsection_header + option_str + aliases_str + "\n" + doc + "\n"
145
135
 
146
136
 
147
137
man_preamble = """\
186
176
.I "BZRPATH"
187
177
Path where
188
178
.B "%(bzrcmd)s"
189
 
is to look for shell plugin external commands.
 
179
is to look for external command.
190
180
.TP
191
181
.I "BZR_EMAIL"
192
182
E-Mail address of the user. Overrides default user config.
208
198
.SH "FILES"
209
199
.TP
210
200
.I "~/.bazaar/bazaar.conf"
211
 
Contains the user's default configuration. The section
 
201
Contains the users default configuration. The section
212
202
.B [DEFAULT]
213
203
is used to define general configuration that will be applied everywhere.
214
204
The section