~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Aaron Bentley
  • Date: 2005-09-01 14:11:13 UTC
  • Revision ID: abentley@panoramicfeedback.com-20050901141113-bc37c80383a77aaf
Tweaked missing-dot handling

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
"""\
 
2
Various useful plugins for working with bzr.
 
3
"""
 
4
import bzrlib.commands
 
5
import push
 
6
import annotate
 
7
import shelf
 
8
import conflicts
 
9
import sys
 
10
import os.path
 
11
sys.path.append(os.path.dirname(__file__))
 
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
 
 
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)
 
32
 
 
33
bzrlib.commands.OPTIONS['no-collapse'] = None
 
34
 
 
35
class cmd_graph_ancestry(bzrlib.commands.Command):
 
36
    """Produce ancestry graphs using dot.
 
37
    
 
38
    Output format is detected according to file extension.  Some of the more
 
39
    common output formats are png, gif, svg, ps.  An extension of '.dot' will
 
40
    cause a dot graph file to be produced.
 
41
 
 
42
    Ancestry is usually collapsed by removing nodes with a single parent
 
43
    and descendant, but this can be disabled with --no-collapse.
 
44
 
 
45
    The current branch's revisions are yellow and labeled R?, where ? is
 
46
    the revno.  Other revisions are labeled with essentially random numbers.
 
47
 
 
48
    Revisions that are not in branch storage have dotted outlines.
 
49
    """
 
50
    takes_args = ['branch', 'file']
 
51
    takes_options = ['no-collapse']
 
52
    def run(self, branch, file, no_collapse=False):
 
53
        import graph
 
54
        graph.write_ancestry_file(branch, file, not no_collapse)
 
55
 
 
56
commands = [push.cmd_push, annotate.cmd_annotate, shelf.cmd_shelve, 
 
57
            shelf.cmd_unshelve, cmd_clean_tree, conflicts.cmd_conflicts,
 
58
            conflicts.cmd_resolve, cmd_graph_ancestry]
 
59
from errors import NoPyBaz
 
60
try:
 
61
    import baz_import
 
62
    commands.append(baz_import.cmd_baz_import)
 
63
 
 
64
except NoPyBaz:
 
65
    class cmd_baz_import(bzrlib.commands.Command):
 
66
        """Disabled. (Requires PyBaz)"""
 
67
    commands.append(cmd_baz_import)
 
68
 
 
69
if hasattr(bzrlib.commands, 'register_command'):
 
70
    for command in commands:
 
71
        bzrlib.commands.register_command(command)