~abentley/bzrtools/bzrtools.dev

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
"""\
Various useful plugins for working with bzr.
"""
import bzrlib.commands
import push
import annotate
import shelf
import conflicts
import sys
import os.path
sys.path.append(os.path.dirname(__file__))

bzrlib.commands.OPTIONS['ignored'] = None

class cmd_clean_tree(bzrlib.commands.Command):
    """Remove unwanted files from working tree.
    Normally, ignored files are left alone.  The --ignored flag will cause them
    to be deleted as well.
    """
    takes_options = ['ignored']
    def run(self, ignored=False):
        import clean_tree
        clean_tree.clean_tree(ignored=ignored)

class cmd_conflicted(bzrlib.commands.Command):
    """List files that have conflicts
    """
    takes_options = ['ignored']
    def run(self, ignored=False):
        import clean_tree
        clean_tree.clean_tree(ignored=ignored)

bzrlib.commands.OPTIONS['no-collapse'] = None

class cmd_graph_ancestry(bzrlib.commands.Command):
    """Produce ancestry graphs using dot.
    
    Output format is detected according to file extension.  Some of the more
    common output formats are png, gif, svg, ps.  An extension of '.dot' will
    cause a dot graph file to be produced.

    Ancestry is usually collapsed by removing nodes with a single parent
    and descendant, but this can be disabled with --no-collapse.

    The current branch's revisions are yellow and labeled R?, where ? is
    the revno.  Other revisions are labeled with essentially random numbers.

    Revisions that are not in branch storage have dotted outlines.
    """
    takes_args = ['branch', 'file']
    takes_options = ['no-collapse']
    def run(self, branch, file, no_collapse=False):
        import graph
        graph.write_ancestry_file(branch, file, not no_collapse)

commands = [push.cmd_push, annotate.cmd_annotate, shelf.cmd_shelve, 
            shelf.cmd_unshelve, cmd_clean_tree, conflicts.cmd_conflicts,
            conflicts.cmd_resolve, cmd_graph_ancestry]
from errors import NoPyBaz
try:
    import baz_import
    commands.append(baz_import.cmd_baz_import)

except NoPyBaz:
    class cmd_baz_import(bzrlib.commands.Command):
        """Disabled. (Requires PyBaz)"""
    commands.append(cmd_baz_import)

if hasattr(bzrlib.commands, 'register_command'):
    for command in commands:
        bzrlib.commands.register_command(command)