~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to __init__.py

merge from aaron

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
import os.path
10
10
sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), 
11
11
                                                 "external")))
 
12
from bzrlib.option import Option
12
13
 
13
 
bzrlib.commands.OPTIONS['ignored'] = None
14
 
bzrlib.commands.OPTIONS['detrius'] = None
 
14
Option.OPTIONS['ignored'] = Option('ignored',
 
15
        help='delete all ignored files.')
 
16
Option.OPTIONS['detrius'] = Option('detrius',
 
17
        help='delete conflict files merge backups, and failed selftest dirs.' +
 
18
              '(*.THIS, *.BASE, *.OTHER, *~, *.tmp')
 
19
Option.OPTIONS['dry-run'] = Option('dry-run',
 
20
        help='show files to delete instead of deleting them.')
15
21
 
16
22
class cmd_clean_tree(bzrlib.commands.Command):
17
23
    """Remove unwanted files from working tree.
18
24
    Normally, ignored files are left alone.
19
 
 
20
 
    OPTIONS:
21
 
    --detrius Delete conflict files and merge backups. (*.THIS, *.BASE, 
22
 
              *.OTHER, *~)
23
 
    --ignored Delete all ignored files.
24
 
    --dry-run Show files to delete instead of deleting them.
25
25
    """
26
26
    takes_options = ['ignored', 'detrius', 'dry-run']
27
27
    def run(self, ignored=False, detrius=False, dry_run=False):
28
 
        import clean_tree
29
 
        from bzrlib.branch import Branch
30
 
        br = Branch.open_containing('.')
31
 
        tree = br.working_tree()
32
 
        deletables = clean_tree.iter_deletables(tree, ignored=ignored, 
33
 
                                                detrius=detrius)
34
 
        clean_tree.clean_tree(deletables, dry_run=dry_run)
 
28
        from clean_tree import clean_tree
 
29
        clean_tree('.', ignored=ignored, detrius=detrius, dry_run=dry_run)
35
30
 
36
 
bzrlib.commands.OPTIONS['no-collapse'] = None
37
 
bzrlib.commands.OPTIONS['no-antialias'] = None
38
 
bzrlib.commands.OPTIONS['cluster'] = None
39
 
bzrlib.commands.OPTIONS['merge-branch'] = str
 
31
Option.OPTIONS['no-collapse'] = Option('no-collapse')
 
32
Option.OPTIONS['no-antialias'] = Option('no-antialias')
 
33
Option.OPTIONS['cluster'] = Option('cluster')
 
34
Option.OPTIONS['merge-branch'] = Option('merge-branch',type=str)
40
35
 
41
36
class cmd_graph_ancestry(bzrlib.commands.Command):
42
37
    """Produce ancestry graphs using dot.
121
116
except NoPyBaz:
122
117
    class cmd_baz_import(bzrlib.commands.Command):
123
118
        """Disabled. (Requires PyBaz)"""
 
119
        takes_args = ['to_root_dir?', 'from_archive?']
 
120
        takes_options = ['verbose']
 
121
        def run(self, to_root_dir=None, from_archive=None, verbose=False):
 
122
            print "This command is disabled.  Please install PyBaz."
124
123
    commands.append(cmd_baz_import)
125
124
 
126
125
if hasattr(bzrlib.commands, 'register_command'):
132
131
    import tests
133
132
    from doctest import DocTestSuite
134
133
    from unittest import TestSuite
 
134
    import clean_tree
135
135
    result = TestSuite()
136
136
    result.addTest(DocTestSuite(bzrtools))
 
137
    result.addTest(clean_tree.test_suite())
137
138
    result.addTest(DocTestSuite(baz_import))
138
139
    result.addTest(tests.test_suite())
139
140
    return result