2
Various useful plugins for working with bzr.
11
sys.path.append(os.path.dirname(__file__))
13
bzrlib.commands.OPTIONS['ignored'] = None
15
class cmd_clean_tree(bzrlib.commands.Command):
16
"""Remove unwanted files from working tree.
17
Normally, ignored files are left alone. The --ignored flag will cause them
18
to be deleted as well.
20
takes_options = ['ignored']
21
def run(self, ignored=False):
23
clean_tree.clean_tree(ignored=ignored)
25
class cmd_conflicted(bzrlib.commands.Command):
26
"""List files that have conflicts
28
takes_options = ['ignored']
29
def run(self, ignored=False):
31
clean_tree.clean_tree(ignored=ignored)
33
bzrlib.commands.OPTIONS['no-collapse'] = None
34
bzrlib.commands.OPTIONS['no-antialias'] = None
35
bzrlib.commands.OPTIONS['cluster'] = None
36
bzrlib.commands.OPTIONS['merge-branch'] = str
38
class cmd_graph_ancestry(bzrlib.commands.Command):
39
"""Produce ancestry graphs using dot.
41
Output format is detected according to file extension. Some of the more
42
common output formats are png, gif, svg, ps. An extension of '.dot' will
43
cause a dot graph file to be produced.
45
Branches are labeled r?, where ? is the revno. If they have no revno,
46
with the last 5 characters of their revision identifier are used instead.
48
If --merge-branch is specified, the two branches are compared and a merge
56
blue COMMON non-history ancestor
57
dotted Missing from branch storage
59
Ancestry is usually collapsed by removing revisions with a single parent
60
and descendant. The number of skipped revisions is shown on the arrow.
61
This feature can be disabled with --no-collapse.
63
By default, revisions are ordered by distance from root, but they can be
64
clustered instead using --cluster.
66
If available, rsvg is used to antialias PNG and JPEG output, but this can
67
be disabled with --no-antialias.
69
takes_args = ['branch', 'file']
70
takes_options = ['no-collapse', 'no-antialias', 'merge-branch', 'cluster']
71
def run(self, branch, file, no_collapse=False, no_antialias=False,
72
merge_branch=None, cluster=False):
78
graph.write_ancestry_file(branch, file, not no_collapse,
79
not no_antialias, merge_branch, ranking)
81
class cmd_fetch_missing(bzrlib.commands.Command):
82
"""Attempt to retrieve missing ancestors from another branch.
83
If the other branch is not supplied, the last-pulled branch is used.
85
takes_args = ['branch?']
86
def run(self, branch=None):
87
from fetch_missing import fetch_missing
90
class cmd_patch(bzrlib.commands.Command):
91
"""Apply a named patch to the current tree.
93
takes_args = ['filename?']
94
takes_options = ['strip']
95
def run(self, filename=None, strip=0):
96
from patch import patch
97
from bzrlib.branch import Branch
98
b = Branch.open_containing('.')
99
return patch(b, filename, strip)
103
commands = [push.cmd_push, annotate.cmd_annotate, shelf.cmd_shelve,
104
shelf.cmd_unshelve, cmd_clean_tree, conflicts.cmd_conflicts,
105
conflicts.cmd_resolve, cmd_graph_ancestry, cmd_fetch_missing,
107
from errors import NoPyBaz
110
commands.append(baz_import.cmd_baz_import)
113
class cmd_baz_import(bzrlib.commands.Command):
114
"""Disabled. (Requires PyBaz)"""
115
commands.append(cmd_baz_import)
117
if hasattr(bzrlib.commands, 'register_command'):
118
for command in commands:
119
bzrlib.commands.register_command(command)
122
from doctest import DocTestSuite
123
return DocTestSuite(bzrtools)