2
Various useful plugins for working with bzr.
10
sys.path.append(os.path.dirname(__file__))
12
bzrlib.commands.OPTIONS['ignored'] = None
14
class cmd_clean_tree(bzrlib.commands.Command):
15
"""Remove unwanted files from working tree.
16
Normally, ignored files are left alone. The --ignored flag will cause them
17
to be deleted as well.
19
takes_options = ['ignored']
20
def run(self, ignored=False):
22
clean_tree.clean_tree(ignored=ignored)
24
bzrlib.commands.OPTIONS['no-collapse'] = None
25
bzrlib.commands.OPTIONS['no-antialias'] = None
26
bzrlib.commands.OPTIONS['cluster'] = None
27
bzrlib.commands.OPTIONS['merge-branch'] = str
29
class cmd_graph_ancestry(bzrlib.commands.Command):
30
"""Produce ancestry graphs using dot.
32
Output format is detected according to file extension. Some of the more
33
common output formats are png, gif, svg, ps. An extension of '.dot' will
34
cause a dot graph file to be produced.
36
Branches are labeled r?, where ? is the revno. If they have no revno,
37
with the last 5 characters of their revision identifier are used instead.
39
If --merge-branch is specified, the two branches are compared and a merge
47
blue COMMON non-history ancestor
48
dotted Missing from branch storage
50
Ancestry is usually collapsed by removing revisions with a single parent
51
and descendant. The number of skipped revisions is shown on the arrow.
52
This feature can be disabled with --no-collapse.
54
By default, revisions are ordered by distance from root, but they can be
55
clustered instead using --cluster.
57
If available, rsvg is used to antialias PNG and JPEG output, but this can
58
be disabled with --no-antialias.
60
takes_args = ['branch', 'file']
61
takes_options = ['no-collapse', 'no-antialias', 'merge-branch', 'cluster']
62
def run(self, branch, file, no_collapse=False, no_antialias=False,
63
merge_branch=None, cluster=False):
69
graph.write_ancestry_file(branch, file, not no_collapse,
70
not no_antialias, merge_branch, ranking)
72
class cmd_fetch_ghosts(bzrlib.commands.Command):
73
"""Attempt to retrieve ghosts from another branch.
74
If the other branch is not supplied, the last-pulled branch is used.
76
aliases = ['fetch-missing']
77
takes_args = ['branch?']
78
def run(self, branch=None):
79
from fetch_ghosts import fetch_ghosts
82
class cmd_patch(bzrlib.commands.Command):
83
"""Apply a named patch to the current tree.
85
takes_args = ['filename?']
86
takes_options = ['strip']
87
def run(self, filename=None, strip=0):
88
from patch import patch
89
from bzrlib.branch import Branch
90
b = Branch.open_containing('.')
91
return patch(b, filename, strip)
95
commands = [push.cmd_push, annotate.cmd_annotate, shelf.cmd_shelve,
96
shelf.cmd_unshelve, cmd_clean_tree, cmd_graph_ancestry,
97
cmd_fetch_ghosts, cmd_patch]
98
from errors import NoPyBaz
101
commands.append(baz_import.cmd_baz_import)
104
class cmd_baz_import(bzrlib.commands.Command):
105
"""Disabled. (Requires PyBaz)"""
106
commands.append(cmd_baz_import)
108
if hasattr(bzrlib.commands, 'register_command'):
109
for command in commands:
110
bzrlib.commands.register_command(command)
113
from doctest import DocTestSuite
114
return DocTestSuite(bzrtools)