/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/help.py

Merge Jan's benchmarks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2004, 2005 by Canonical Ltd
2
 
 
 
1
# Copyright (C) 2004, 2005, 2006 by Canonical Ltd
 
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
5
5
# the Free Software Foundation; either version 2 of the License, or
6
6
# (at your option) any later version.
7
 
 
 
7
#
8
8
# This program is distributed in the hope that it will be useful,
9
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
11
# GNU General Public License for more details.
12
 
 
 
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23
23
import textwrap
24
24
 
25
25
global_help = \
26
 
"""Bazaar-NG -- a free distributed version-control tool
27
 
http://bazaar-ng.org/
28
 
 
29
 
WARNING: This is an unstable development version.
30
 
         Please keep backups.
 
26
"""Bazaar -- a free distributed version-control tool
 
27
http://bazaar-vcs.org/
31
28
 
32
29
Basic commands:
33
30
 
88
85
    return s
89
86
 
90
87
 
 
88
def print_command_plugin(cmd_object, outfile, format):
 
89
    """Print the plugin that provides a command object, if any.
 
90
 
 
91
    If the cmd_object is provided by a plugin, prints the plugin name to
 
92
    outfile using the provided format string.
 
93
    """
 
94
    plugin_name = cmd_object.plugin_name()
 
95
    if plugin_name is not None:
 
96
        out_str = '(From plugin "%s")' % plugin_name
 
97
        outfile.write(format % out_str)
 
98
 
 
99
 
91
100
def help_on_command(cmdname, outfile=None):
92
101
    from bzrlib.commands import get_cmd_object
93
102
 
110
119
 
111
120
    print >>outfile
112
121
 
 
122
    print_command_plugin(cmd_object, outfile, '%s\n\n')
 
123
 
113
124
    outfile.write(doc)
114
125
    if doc[-1] != '\n':
115
126
        outfile.write('\n')
159
170
        if cmd_object.hidden:
160
171
            continue
161
172
        print >>outfile, command_usage(cmd_object)
 
173
 
 
174
        plugin_name = cmd_object.plugin_name()
 
175
        print_command_plugin(cmd_object, outfile, '        %s\n')
 
176
 
162
177
        cmd_help = cmd_object.help()
163
178
        if cmd_help:
164
179
            firstline = cmd_help.split('\n', 1)[0]