124
by Aaron Bentley
Added docstring for bzrtools |
1 |
"""\
|
2 |
Various useful plugins for working with bzr.
|
|
3 |
"""
|
|
93
by Aaron Bentley
Used the bzr 0.5+ plugin stuff |
4 |
import bzrlib.commands |
5 |
import push |
|
6 |
import annotate |
|
7 |
import shelf |
|
119
by aaron.bentley at utoronto
Added conflict-awareness tools |
8 |
import conflicts |
132
by Aaron Bentley
brute-forced bzrtools path into sys.path so baz-import works |
9 |
import sys |
10 |
import os.path |
|
11 |
sys.path.append(os.path.dirname(__file__)) |
|
118
by aaron.bentley at utoronto
Added clean-tree command |
12 |
|
13 |
bzrlib.commands.OPTIONS['ignored'] = None |
|
14 |
||
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.
|
|
19 |
"""
|
|
20 |
takes_options = ['ignored'] |
|
21 |
def run(self, ignored=False): |
|
22 |
import clean_tree |
|
23 |
clean_tree.clean_tree(ignored=ignored) |
|
24 |
||
119
by aaron.bentley at utoronto
Added conflict-awareness tools |
25 |
class cmd_conflicted(bzrlib.commands.Command): |
26 |
"""List files that have conflicts
|
|
27 |
"""
|
|
28 |
takes_options = ['ignored'] |
|
29 |
def run(self, ignored=False): |
|
30 |
import clean_tree |
|
31 |
clean_tree.clean_tree(ignored=ignored) |
|
118
by aaron.bentley at utoronto
Added clean-tree command |
32 |
|
136
by Aaron Bentley
Allowed disabling ancestry collapsing |
33 |
bzrlib.commands.OPTIONS['no-collapse'] = None |
143
by Aaron Bentley
Used rsvga for nice antialiasing |
34 |
bzrlib.commands.OPTIONS['no-antialias'] = None |
136
by Aaron Bentley
Allowed disabling ancestry collapsing |
35 |
|
128
by Aaron Bentley
Got initial graphing functionality working |
36 |
class cmd_graph_ancestry(bzrlib.commands.Command): |
136
by Aaron Bentley
Allowed disabling ancestry collapsing |
37 |
"""Produce ancestry graphs using dot.
|
38 |
|
|
39 |
Output format is detected according to file extension. Some of the more
|
|
137
by Aaron Bentley
Put dotted outlines on missing revisions |
40 |
common output formats are png, gif, svg, ps. An extension of '.dot' will
|
41 |
cause a dot graph file to be produced.
|
|
136
by Aaron Bentley
Allowed disabling ancestry collapsing |
42 |
|
43 |
Ancestry is usually collapsed by removing nodes with a single parent
|
|
44 |
and descendant, but this can be disabled with --no-collapse.
|
|
137
by Aaron Bentley
Put dotted outlines on missing revisions |
45 |
|
46 |
The current branch's revisions are yellow and labeled R?, where ? is
|
|
47 |
the revno. Other revisions are labeled with essentially random numbers.
|
|
48 |
||
49 |
Revisions that are not in branch storage have dotted outlines.
|
|
143
by Aaron Bentley
Used rsvga for nice antialiasing |
50 |
|
51 |
rsvg is used to antialias PNG and JPEG output, but this can be disabled
|
|
52 |
with --no-antialias.
|
|
136
by Aaron Bentley
Allowed disabling ancestry collapsing |
53 |
"""
|
131
by Aaron Bentley
Added required filename parameter |
54 |
takes_args = ['branch', 'file'] |
143
by Aaron Bentley
Used rsvga for nice antialiasing |
55 |
takes_options = ['no-collapse', 'no-antialias'] |
56 |
def run(self, branch, file, no_collapse=False, no_antialias=False): |
|
128
by Aaron Bentley
Got initial graphing functionality working |
57 |
import graph |
143
by Aaron Bentley
Used rsvga for nice antialiasing |
58 |
graph.write_ancestry_file(branch, file, not no_collapse, |
59 |
not no_antialias) |
|
128
by Aaron Bentley
Got initial graphing functionality working |
60 |
|
144
by aaron.bentley at utoronto
Added fetch-missing command |
61 |
class cmd_fetch_missing(bzrlib.commands.Command): |
150
by abentley
Made fetch_missing use the x-pull file |
62 |
"""Attempt to retrieve missing ancestors from another branch.
|
63 |
If the other branch is not supplied, the last-pulled branch is used.
|
|
144
by aaron.bentley at utoronto
Added fetch-missing command |
64 |
"""
|
150
by abentley
Made fetch_missing use the x-pull file |
65 |
takes_args = ['branch?'] |
66 |
def run(self, branch=None): |
|
144
by aaron.bentley at utoronto
Added fetch-missing command |
67 |
from fetch_missing import fetch_missing |
68 |
fetch_missing(branch) |
|
69 |
||
152
by Aaron Bentley
Added new bzr patch command |
70 |
class cmd_patch(bzrlib.commands.Command): |
71 |
"""Apply a named patch to the current tree.
|
|
72 |
"""
|
|
73 |
takes_args = ['filename?'] |
|
74 |
takes_options = ['strip'] |
|
75 |
def run(self, filename=None, strip=0): |
|
76 |
from patch import patch |
|
77 |
from bzrlib.branch import Branch |
|
78 |
b = Branch('.', find_root=True) |
|
79 |
return patch(b, filename, strip) |
|
80 |
||
81 |
||
82 |
||
100
by Aaron Bentley
Fixed up the baz-import plugin |
83 |
commands = [push.cmd_push, annotate.cmd_annotate, shelf.cmd_shelve, |
122
by aaron.bentley at utoronto
Added resolve command |
84 |
shelf.cmd_unshelve, cmd_clean_tree, conflicts.cmd_conflicts, |
152
by Aaron Bentley
Added new bzr patch command |
85 |
conflicts.cmd_resolve, cmd_graph_ancestry, cmd_fetch_missing, |
86 |
cmd_patch] |
|
105
by Aaron Bentley
Fixed NoPyBaz detection |
87 |
from errors import NoPyBaz |
100
by Aaron Bentley
Fixed up the baz-import plugin |
88 |
try: |
89 |
import baz_import |
|
90 |
commands.append(baz_import.cmd_baz_import) |
|
105
by Aaron Bentley
Fixed NoPyBaz detection |
91 |
|
92 |
except NoPyBaz: |
|
100
by Aaron Bentley
Fixed up the baz-import plugin |
93 |
class cmd_baz_import(bzrlib.commands.Command): |
94 |
"""Disabled. (Requires PyBaz)"""
|
|
95 |
commands.append(cmd_baz_import) |
|
96 |
||
94
by Aaron Bentley
Adjsted to match plugin api |
97 |
if hasattr(bzrlib.commands, 'register_command'): |
93
by Aaron Bentley
Used the bzr 0.5+ plugin stuff |
98 |
for command in commands: |
94
by Aaron Bentley
Adjsted to match plugin api |
99 |
bzrlib.commands.register_command(command) |
147
by Robert Collins
make bzr selftest run the plugins tests, and fix them |
100 |
|
101 |
def test_suite(): |
|
102 |
from doctest import DocTestSuite |
|
103 |
return DocTestSuite(bzrtools) |