18
18
"""Bazaar-NG -- a free distributed version-control tool
19
19
http://bazaar-ng.org/
21
WARNING: This is an unstable development version.
26
bzr init makes this branch versioned
27
bzr branch make a copy of another branch
29
bzr add make files or directories versioned
30
bzr ignore ignore a file or pattern
31
bzr mv move or rename a versioned file
33
bzr status summarize changes in working copy
34
bzr diff show detailed diffs
36
bzr merge pull in changes from another branch
39
bzr log show history of changes
40
bzr check validate storage
42
Use e.g. 'bzr help init' for more details, or 'bzr help commands' for
21
**WARNING: THIS IS AN UNSTABLE DEVELOPMENT VERSION**
23
* Metadata format is not stable yet -- you may need to
24
discard history in the future.
26
* Many commands unimplemented or partially implemented.
28
* Space-inefficient storage.
30
* No merge operators yet.
37
Show software version/licence/non-warranty.
39
Start versioning the current directory
43
Show revision history.
46
bzr move FROM... DESTDIR
47
Move one or more files to a different directory.
49
Show changes from last revision to working copy.
50
bzr commit -m 'MESSAGE'
51
Store current state as new revision.
52
bzr export [-r REVNO] DESTINATION
53
Export the branch state at a previous version.
55
Show summary of pending changes.
57
Make a file not versioned.
59
Show statistics about this branch.
61
Verify history is stored safely.
62
(for more type 'bzr help commands')
50
def help(topic=None, outfile = None):
54
outfile.write(global_help)
55
69
elif topic == 'commands':
56
help_commands(outfile = outfile)
58
help_on_command(topic, outfile = outfile)
61
def command_usage(cmdname, cmdclass):
62
"""Return single-line grammar for command.
64
Only describes arguments, not options.
72
help_on_command(topic)
75
def help_on_command(cmdname):
76
cmdname = str(cmdname)
78
from inspect import getdoc
80
topic, cmdclass = commands.get_cmd_class(cmdname)
82
doc = getdoc(cmdclass)
84
raise NotImplementedError("sorry, no detailed help yet for %r" % cmdname)
87
short, rest = doc.split('\n', 1)
92
print 'usage: bzr ' + topic,
67
93
for aname in cmdclass.takes_args:
68
94
aname = aname.upper()
69
95
if aname[-1] in ['$', '+']:
72
98
aname = '[' + aname[:-1] + ']'
73
99
elif aname[-1] == '*':
74
100
aname = '[' + aname[:-1] + '...]'
83
def help_on_command(cmdname, outfile = None):
84
cmdname = str(cmdname)
89
from inspect import getdoc
91
topic, cmdclass = commands.get_cmd_class(cmdname)
93
doc = getdoc(cmdclass)
95
raise NotImplementedError("sorry, no detailed help yet for %r" % cmdname)
97
outfile.write('usage: ' + command_usage(topic, cmdclass) + '\n')
99
105
if cmdclass.aliases:
100
outfile.write('aliases: ' + ', '.join(cmdclass.aliases) + '\n')
106
help_on_option(cmdclass.takes_options, outfile = None)
109
def help_on_option(options, outfile = None):
106
print 'aliases: ' + ', '.join(cmdclass.aliases)
111
help_on_option(cmdclass.takes_options)
114
def help_on_option(options):
118
outfile.write('\noptions:\n')
119
122
for on in options:
121
124
for shortname, longname in commands.SHORT_OPTIONS.items():
122
125
if longname == on:
123
126
l += ', -' + shortname
125
outfile.write(l + '\n')
128
def help_commands(outfile = None):
129
132
"""List all commands"""
137
137
for cmdname, cmdclass in commands.get_all_cmds():