~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Aaron Bentley
  • Date: 2005-11-11 17:43:12 UTC
  • Revision ID: aaron.bentley@utoronto.ca-20051111174312-1c627d82a07bf8fd
Added patch for tab-in-patch-filename support

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
 
bzrlib.commands.OPTIONS['no-antialias'] = None
35
 
 
36
 
class cmd_graph_ancestry(bzrlib.commands.Command):
37
 
    """Produce ancestry graphs using dot.
38
 
    
39
 
    Output format is detected according to file extension.  Some of the more
40
 
    common output formats are png, gif, svg, ps.  An extension of '.dot' will
41
 
    cause a dot graph file to be produced.
42
 
 
43
 
    Ancestry is usually collapsed by removing nodes with a single parent
44
 
    and descendant, but this can be disabled with --no-collapse.
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.
50
 
 
51
 
    rsvg is used to antialias PNG and JPEG output, but this can be disabled
52
 
    with --no-antialias.
53
 
    """
54
 
    takes_args = ['branch', 'file']
55
 
    takes_options = ['no-collapse', 'no-antialias']
56
 
    def run(self, branch, file, no_collapse=False, no_antialias=False):
57
 
        import graph
58
 
        graph.write_ancestry_file(branch, file, not no_collapse, 
59
 
                                  not no_antialias)
60
 
 
61
 
class cmd_fetch_missing(bzrlib.commands.Command):
62
 
    """Attempt to retrieve missing ancestors from another branch
63
 
    """
64
 
    takes_args = ['branch']
65
 
    def run(self, branch):
66
 
        from fetch_missing import fetch_missing
67
 
        fetch_missing(branch)
68
 
 
69
 
commands = [push.cmd_push, annotate.cmd_annotate, shelf.cmd_shelve, 
70
 
            shelf.cmd_unshelve, cmd_clean_tree, conflicts.cmd_conflicts,
71
 
            conflicts.cmd_resolve, cmd_graph_ancestry, cmd_fetch_missing]
72
 
from errors import NoPyBaz
73
 
try:
74
 
    import baz_import
75
 
    commands.append(baz_import.cmd_baz_import)
76
 
 
77
 
except NoPyBaz:
78
 
    class cmd_baz_import(bzrlib.commands.Command):
79
 
        """Disabled. (Requires PyBaz)"""
80
 
    commands.append(cmd_baz_import)
81
 
 
82
 
if hasattr(bzrlib.commands, 'register_command'):
83
 
    for command in commands:
84
 
        bzrlib.commands.register_command(command)
85
 
 
86
 
def test_suite():
87
 
    import tests
88
 
    from doctest import DocTestSuite
89
 
    from unittest import TestSuite
90
 
    result = TestSuite()
91
 
    result.addTest(DocTestSuite(bzrtools))
92
 
    result.addTest(tests.test_suite())
93
 
    return result