~abentley/bzrtools/bzrtools.dev

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
118 by aaron.bentley at utoronto
Added clean-tree command
9
10
bzrlib.commands.OPTIONS['ignored'] = None
11
12
class cmd_clean_tree(bzrlib.commands.Command):
13
    """Remove unwanted files from working tree.
14
    Normally, ignored files are left alone.  The --ignored flag will cause them
15
    to be deleted as well.
16
    """
17
    takes_options = ['ignored']
18
    def run(self, ignored=False):
19
        import clean_tree
20
        clean_tree.clean_tree(ignored=ignored)
21
119 by aaron.bentley at utoronto
Added conflict-awareness tools
22
class cmd_conflicted(bzrlib.commands.Command):
23
    """List files that have conflicts
24
    """
25
    takes_options = ['ignored']
26
    def run(self, ignored=False):
27
        import clean_tree
28
        clean_tree.clean_tree(ignored=ignored)
118 by aaron.bentley at utoronto
Added clean-tree command
29
100 by Aaron Bentley
Fixed up the baz-import plugin
30
commands = [push.cmd_push, annotate.cmd_annotate, shelf.cmd_shelve, 
122 by aaron.bentley at utoronto
Added resolve command
31
            shelf.cmd_unshelve, cmd_clean_tree, conflicts.cmd_conflicts,
32
            conflicts.cmd_resolve]
105 by Aaron Bentley
Fixed NoPyBaz detection
33
from errors import NoPyBaz
100 by Aaron Bentley
Fixed up the baz-import plugin
34
try:
35
    import baz_import
36
    commands.append(baz_import.cmd_baz_import)
105 by Aaron Bentley
Fixed NoPyBaz detection
37
38
except NoPyBaz:
100 by Aaron Bentley
Fixed up the baz-import plugin
39
    class cmd_baz_import(bzrlib.commands.Command):
40
        """Disabled. (Requires PyBaz)"""
41
    commands.append(cmd_baz_import)
42
94 by Aaron Bentley
Adjsted to match plugin api
43
if hasattr(bzrlib.commands, 'register_command'):
93 by Aaron Bentley
Used the bzr 0.5+ plugin stuff
44
    for command in commands:
94 by Aaron Bentley
Adjsted to match plugin api
45
        bzrlib.commands.register_command(command)