2
Various useful plugins for working with bzr.
10
sys.path.append(os.path.dirname(__file__))
12
bzrlib.commands.OPTIONS['ignored'] = None
13
bzrlib.commands.OPTIONS['detrius'] = None
15
class cmd_clean_tree(bzrlib.commands.Command):
16
"""Remove unwanted files from working tree.
17
Normally, ignored files are left alone.
20
--detrius Delete conflict files and merge backups. (*.THIS, *.BASE,
22
--ignored Delete all ignored files.
23
--dry-run Show files to delete instead of deleting them.
25
takes_options = ['ignored', 'detrius', 'dry-run']
26
def run(self, ignored=False, detrius=False, dry_run=False):
28
from bzrlib.branch import Branch
29
br = Branch.open_containing('.')
30
tree = br.working_tree()
31
deletables = clean_tree.iter_deletables(tree, ignored=ignored,
33
clean_tree.clean_tree(deletables, dry_run=dry_run)
35
bzrlib.commands.OPTIONS['no-collapse'] = None
36
bzrlib.commands.OPTIONS['no-antialias'] = None
37
bzrlib.commands.OPTIONS['cluster'] = None
38
bzrlib.commands.OPTIONS['merge-branch'] = str
40
class cmd_graph_ancestry(bzrlib.commands.Command):
41
"""Produce ancestry graphs using dot.
43
Output format is detected according to file extension. Some of the more
44
common output formats are png, gif, svg, ps. An extension of '.dot' will
45
cause a dot graph file to be produced.
47
Branches are labeled r?, where ? is the revno. If they have no revno,
48
with the last 5 characters of their revision identifier are used instead.
50
If --merge-branch is specified, the two branches are compared and a merge
58
blue COMMON non-history ancestor
59
dotted Missing from branch storage
61
Ancestry is usually collapsed by removing revisions with a single parent
62
and descendant. The number of skipped revisions is shown on the arrow.
63
This feature can be disabled with --no-collapse.
65
By default, revisions are ordered by distance from root, but they can be
66
clustered instead using --cluster.
68
If available, rsvg is used to antialias PNG and JPEG output, but this can
69
be disabled with --no-antialias.
71
takes_args = ['branch', 'file']
72
takes_options = ['no-collapse', 'no-antialias', 'merge-branch', 'cluster']
73
def run(self, branch, file, no_collapse=False, no_antialias=False,
74
merge_branch=None, cluster=False):
80
graph.write_ancestry_file(branch, file, not no_collapse,
81
not no_antialias, merge_branch, ranking)
83
class cmd_fetch_ghosts(bzrlib.commands.Command):
84
"""Attempt to retrieve ghosts from another branch.
85
If the other branch is not supplied, the last-pulled branch is used.
87
aliases = ['fetch-missing']
88
takes_args = ['branch?']
89
def run(self, branch=None):
90
from fetch_ghosts import fetch_ghosts
93
class cmd_patch(bzrlib.commands.Command):
94
"""Apply a named patch to the current tree.
96
takes_args = ['filename?']
97
takes_options = ['strip']
98
def run(self, filename=None, strip=0):
99
from patch import patch
100
from bzrlib.branch import Branch
101
b = Branch.open_containing('.')
102
return patch(b, filename, strip)
106
commands = [push.cmd_push, annotate.cmd_annotate, shelf.cmd_shelve,
107
shelf.cmd_unshelve, cmd_clean_tree, cmd_graph_ancestry,
108
cmd_fetch_ghosts, cmd_patch]
109
from errors import NoPyBaz
112
commands.append(baz_import.cmd_baz_import)
115
class cmd_baz_import(bzrlib.commands.Command):
116
"""Disabled. (Requires PyBaz)"""
117
commands.append(cmd_baz_import)
119
if hasattr(bzrlib.commands, 'register_command'):
120
for command in commands:
121
bzrlib.commands.register_command(command)
124
from doctest import DocTestSuite
125
return DocTestSuite(bzrtools)