12
12
import bzrlib.branch
13
13
from bzrlib.errors import BzrCommandError
14
14
sys.path.append(os.path.dirname(__file__))
15
from reweave_inventory import cmd_fix
17
16
Option.OPTIONS['ignored'] = Option('ignored',
18
17
help='delete all ignored files.')
19
Option.OPTIONS['detritus'] = Option('detritus',
18
Option.OPTIONS['detrius'] = Option('detrius',
20
19
help='delete conflict files merge backups, and failed selftest dirs.' +
21
20
'(*.THIS, *.BASE, *.OTHER, *~, *.tmp')
22
21
Option.OPTIONS['dry-run'] = Option('dry-run',
26
25
"""Remove unwanted files from working tree.
27
26
Normally, ignored files are left alone.
29
takes_options = ['ignored', 'detritus', 'dry-run']
30
def run(self, ignored=False, detritus=False, dry_run=False):
28
takes_options = ['ignored', 'detrius', 'dry-run']
29
def run(self, ignored=False, detrius=False, dry_run=False):
31
30
from clean_tree import clean_tree
32
clean_tree('.', ignored=ignored, detritus=detritus, dry_run=dry_run)
31
clean_tree('.', ignored=ignored, detrius=detrius, dry_run=dry_run)
33
Option.OPTIONS['no-collapse'] = Option('no-collapse')
34
Option.OPTIONS['no-antialias'] = Option('no-antialias')
35
Option.OPTIONS['cluster'] = Option('cluster')
34
36
Option.OPTIONS['merge-branch'] = Option('merge-branch',type=str)
36
38
class cmd_graph_ancestry(bzrlib.commands.Command):
37
39
"""Produce ancestry graphs using dot.
39
41
Output format is detected according to file extension. Some of the more
40
common output formats are html, png, gif, svg, ps. An extension of '.dot'
41
will cause a dot graph file to be produced. HTML output has mouseovers
42
that show the commit message.
42
common output formats are png, gif, svg, ps. An extension of '.dot' will
43
cause a dot graph file to be produced.
44
45
Branches are labeled r?, where ? is the revno. If they have no revno,
45
46
with the last 5 characters of their revision identifier are used instead.
47
The value starting with d is "(maximum) distance from the null revision".
49
48
If --merge-branch is specified, the two branches are compared and a merge
56
55
orange COMMON history
57
56
blue COMMON non-history ancestor
58
green Merge base (COMMON ancestor farthest from the null revision)
59
dotted Ghost revision (missing from branch storage)
57
dotted Missing from branch storage
61
Ancestry is usually collapsed by skipping revisions with a single parent
59
Ancestry is usually collapsed by removing revisions with a single parent
62
60
and descendant. The number of skipped revisions is shown on the arrow.
63
61
This feature can be disabled with --no-collapse.
69
67
be disabled with --no-antialias.
71
69
takes_args = ['branch', 'file']
72
takes_options = [Option('no-collapse', help="Do not skip simple nodes"),
73
Option('no-antialias',
74
help="Do not use rsvg to produce antialiased output"),
75
Option('merge-branch', type=str,
76
help="Use this branch to calcuate a merge base"),
77
Option('cluster', help="Use clustered output.")]
70
takes_options = ['no-collapse', 'no-antialias', 'merge-branch', 'cluster']
78
71
def run(self, branch, file, no_collapse=False, no_antialias=False,
79
72
merge_branch=None, cluster=False):
92
85
aliases = ['fetch-missing']
93
86
takes_args = ['branch?']
94
takes_options = [Option('no-fix')]
95
def run(self, branch=None, no_fix=False):
87
def run(self, branch=None):
96
88
from fetch_ghosts import fetch_ghosts
97
fetch_ghosts(branch, no_fix)
99
91
strip_help="""Strip the smallest prefix containing num leading slashes from \
100
92
each file name found in the patch file."""
114
106
class cmd_shelve(bzrlib.commands.Command):
115
"""Temporarily remove some text changes from the current tree.
107
"""Temporarily remove some changes from the current tree.
116
108
Use 'unshelve' to restore these changes.
118
Shelve is intended to help separate several sets of text changes that have
119
been inappropriately mingled. If you just want to get rid of all changes
120
(text and otherwise) and you don't need to restore them later, use revert.
121
If you want to shelve all text changes at once, use shelve --all.
123
If filenames are specified, only changes to those files will be shelved.
110
If filenames are specified, only changes to those files will be unshelved.
124
111
If a revision is specified, all changes since that revision will may be
127
114
takes_args = ['file*']
128
takes_options = [Option('all',
129
help='Shelve all changes without prompting'),
130
'message', 'revision']
115
takes_options = ['all', 'message', 'revision']
131
116
def run(self, all=False, file_list=None, message=None, revision=None):
132
117
if file_list is not None and len(file_list) > 0:
133
118
branchdir = file_list[0]
154
139
return s.unshelve()
156
141
class cmd_shell(bzrlib.commands.Command):
157
"""Begin an interactive shell tailored for bzr.
158
Bzr commands can be used without typing bzr first, and will be run natively
159
when possible. Tab completion is tailored for bzr. The shell prompt shows
160
the branch nick, revno, and path.
162
If it encounters any moderately complicated shell command, it will punt to
167
bzr bzrtools:287/> status
170
bzr bzrtools:287/> status --[TAB][TAB]
171
--all --help --revision --show-ids
172
bzr bzrtools:287/> status --
176
return shell.run_shell()
178
class cmd_branch_history(bzrlib.commands.Command):
180
Display the revision history with reference to lines of development.
182
Each different committer or branch nick is considered a different line of
183
development. Committers are treated as the same if they have the same
184
name, or if they have the same email address.
186
takes_args = ["branch?"]
187
def run(self, branch=None):
188
from branchhistory import branch_history
189
return branch_history(branch)
191
146
commands = [cmd_shelve, cmd_unshelve, cmd_clean_tree, cmd_graph_ancestry,
192
cmd_fetch_ghosts, cmd_patch, cmd_shell, cmd_fix, cmd_branch_history]
194
command_decorators = []
147
cmd_fetch_ghosts, cmd_patch, cmd_shell]
196
149
import bzrlib.builtins
197
150
if not hasattr(bzrlib.builtins, "cmd_annotate"):
198
151
commands.append(annotate.cmd_annotate)
199
152
if not hasattr(bzrlib.builtins, "cmd_push"):
200
153
commands.append(push.cmd_push)
202
command_decorators.append(push.cmd_push)
204
155
from errors import NoPyBaz
215
166
print "This command is disabled. Please install PyBaz."
216
167
commands.append(cmd_baz_import)
219
169
if hasattr(bzrlib.commands, 'register_command'):
220
170
for command in commands:
221
171
bzrlib.commands.register_command(command)
222
for command in command_decorators:
223
command._original_command = bzrlib.commands.register_command(
227
173
def test_suite():
228
174
from doctest import DocTestSuite