2
Various useful plugins for working with bzr.
11
sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__),
14
bzrlib.commands.OPTIONS['ignored'] = None
16
class cmd_clean_tree(bzrlib.commands.Command):
17
"""Remove unwanted files from working tree.
18
Normally, ignored files are left alone. The --ignored flag will cause them
19
to be deleted as well.
21
takes_options = ['ignored']
22
def run(self, ignored=False):
24
clean_tree.clean_tree(ignored=ignored)
26
class cmd_conflicted(bzrlib.commands.Command):
27
"""List files that have conflicts
29
takes_options = ['ignored']
30
def run(self, ignored=False):
32
clean_tree.clean_tree(ignored=ignored)
34
bzrlib.commands.OPTIONS['no-collapse'] = None
35
bzrlib.commands.OPTIONS['no-antialias'] = None
36
bzrlib.commands.OPTIONS['cluster'] = None
37
bzrlib.commands.OPTIONS['merge-branch'] = str
39
class cmd_graph_ancestry(bzrlib.commands.Command):
40
"""Produce ancestry graphs using dot.
42
Output format is detected according to file extension. Some of the more
43
common output formats are png, gif, svg, ps. An extension of '.dot' will
44
cause a dot graph file to be produced.
46
Branches are labeled r?, where ? is the revno. If they have no revno,
47
with the last 5 characters of their revision identifier are used instead.
49
If --merge-branch is specified, the two branches are compared and a merge
57
blue COMMON non-history ancestor
58
dotted Missing from branch storage
60
Ancestry is usually collapsed by removing revisions with a single parent
61
and descendant. The number of skipped revisions is shown on the arrow.
62
This feature can be disabled with --no-collapse.
64
By default, revisions are ordered by distance from root, but they can be
65
clustered instead using --cluster.
67
If available, rsvg is used to antialias PNG and JPEG output, but this can
68
be disabled with --no-antialias.
70
takes_args = ['branch', 'file']
71
takes_options = ['no-collapse', 'no-antialias', 'merge-branch', 'cluster']
72
def run(self, branch, file, no_collapse=False, no_antialias=False,
73
merge_branch=None, cluster=False):
79
graph.write_ancestry_file(branch, file, not no_collapse,
80
not no_antialias, merge_branch, ranking)
82
class cmd_fetch_missing(bzrlib.commands.Command):
83
"""Attempt to retrieve missing ancestors from another branch.
84
If the other branch is not supplied, the last-pulled branch is used.
86
takes_args = ['branch?']
87
def run(self, branch=None):
88
from fetch_missing import fetch_missing
91
class cmd_patch(bzrlib.commands.Command):
92
"""Apply a named patch to the current tree.
94
takes_args = ['filename?']
95
takes_options = ['strip']
96
def run(self, filename=None, strip=0):
97
from patch import patch
98
from bzrlib.branch import Branch
99
b = Branch.open_containing('.')
100
return patch(b, filename, strip)
104
commands = [push.cmd_push, annotate.cmd_annotate, shelf.cmd_shelve,
105
shelf.cmd_unshelve, cmd_clean_tree, conflicts.cmd_conflicts,
106
conflicts.cmd_resolve, cmd_graph_ancestry, cmd_fetch_missing,
108
from errors import NoPyBaz
111
commands.append(baz_import.cmd_baz_import_branch)
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)
126
from doctest import DocTestSuite
127
from unittest import TestSuite
129
result.addTest(DocTestSuite(bzrtools))
130
result.addTest(DocTestSuite(baz_import))
131
result.addTest(tests.test_suite())