~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Aaron Bentley
  • Date: 2005-09-29 16:16:56 UTC
  • mto: (147.2.17)
  • mto: This revision was merged to the branch mainline in revision 324.
  • Revision ID: abentley@panoramicfeedback.com-20050929161656-0aa948c2f00f3655
Fixed import issues w/ PyBaz

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
import push
6
6
import annotate
7
7
import shelf
 
8
import conflicts
8
9
import sys
9
10
import os.path
10
 
sys.path.append(os.path.dirname(__file__))
 
11
sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), 
 
12
                                                 "external")))
11
13
 
12
14
bzrlib.commands.OPTIONS['ignored'] = None
13
 
bzrlib.commands.OPTIONS['detrius'] = None
14
15
 
15
16
class cmd_clean_tree(bzrlib.commands.Command):
16
17
    """Remove unwanted files from working tree.
17
 
    Normally, ignored files are left alone.
 
18
    Normally, ignored files are left alone.  The --ignored flag will cause them
 
19
    to be deleted as well.
 
20
    """
 
21
    takes_options = ['ignored']
 
22
    def run(self, ignored=False):
 
23
        import clean_tree
 
24
        clean_tree.clean_tree(ignored=ignored)
18
25
 
19
 
    OPTIONS:
20
 
    --detrius Delete conflict files and merge backups. (*.THIS, *.BASE, 
21
 
              *.OTHER, *~)
22
 
    --ignored Delete all ignored files.
23
 
    --dry-run Show files to delete instead of deleting them.
 
26
class cmd_conflicted(bzrlib.commands.Command):
 
27
    """List files that have conflicts
24
28
    """
25
 
    takes_options = ['ignored', 'detrius', 'dry-run']
26
 
    def run(self, ignored=False, detrius=False, dry_run=False):
 
29
    takes_options = ['ignored']
 
30
    def run(self, ignored=False):
27
31
        import clean_tree
28
 
        from bzrlib.branch import Branch
29
 
        br = Branch.open_containing('.')
30
 
        tree = br.working_tree()
31
 
        deletables = clean_tree.iter_deletables(tree, ignored=ignored, 
32
 
                                                detrius=detrius)
33
 
        clean_tree.clean_tree(deletables, dry_run=dry_run)
 
32
        clean_tree.clean_tree(ignored=ignored)
34
33
 
35
34
bzrlib.commands.OPTIONS['no-collapse'] = None
36
35
bzrlib.commands.OPTIONS['no-antialias'] = None
80
79
        graph.write_ancestry_file(branch, file, not no_collapse, 
81
80
                                  not no_antialias, merge_branch, ranking)
82
81
 
83
 
class cmd_fetch_ghosts(bzrlib.commands.Command):
84
 
    """Attempt to retrieve ghosts from another branch.
 
82
class cmd_fetch_missing(bzrlib.commands.Command):
 
83
    """Attempt to retrieve missing ancestors from another branch.
85
84
    If the other branch is not supplied, the last-pulled branch is used.
86
85
    """
87
 
    aliases = ['fetch-missing']
88
86
    takes_args = ['branch?']
89
87
    def run(self, branch=None):
90
 
        from fetch_ghosts import fetch_ghosts
91
 
        fetch_ghosts(branch)
 
88
        from fetch_missing import fetch_missing
 
89
        fetch_missing(branch)
92
90
 
93
91
class cmd_patch(bzrlib.commands.Command):
94
92
    """Apply a named patch to the current tree.
104
102
 
105
103
 
106
104
commands = [push.cmd_push, annotate.cmd_annotate, shelf.cmd_shelve, 
107
 
            shelf.cmd_unshelve, cmd_clean_tree, cmd_graph_ancestry,
108
 
            cmd_fetch_ghosts, cmd_patch]
 
105
            shelf.cmd_unshelve, cmd_clean_tree, conflicts.cmd_conflicts,
 
106
            conflicts.cmd_resolve, cmd_graph_ancestry, cmd_fetch_missing,
 
107
            cmd_patch]
109
108
from errors import NoPyBaz
110
109
try:
111
110
    import baz_import
 
111
    commands.append(baz_import.cmd_baz_import_branch)
112
112
    commands.append(baz_import.cmd_baz_import)
113
113
 
114
114
except NoPyBaz:
121
121
        bzrlib.commands.register_command(command)
122
122
 
123
123
def test_suite():
 
124
    import baz_import
 
125
    import tests
124
126
    from doctest import DocTestSuite
125
 
    return DocTestSuite(bzrtools)
 
127
    from unittest import TestSuite
 
128
    result = TestSuite()
 
129
    result.addTest(DocTestSuite(bzrtools))
 
130
    result.addTest(DocTestSuite(baz_import))
 
131
    result.addTest(tests.test_suite())
 
132
    return result