11
11
from bzrlib.option import Option
12
12
import bzrlib.branch
13
13
from bzrlib.errors import BzrCommandError
14
from reweave_inventory import cmd_fix
15
sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__),
14
sys.path.append(os.path.dirname(__file__))
18
16
Option.OPTIONS['ignored'] = Option('ignored',
19
17
help='delete all ignored files.')
20
Option.OPTIONS['detritus'] = Option('detritus',
18
Option.OPTIONS['detrius'] = Option('detrius',
21
19
help='delete conflict files merge backups, and failed selftest dirs.' +
22
20
'(*.THIS, *.BASE, *.OTHER, *~, *.tmp')
23
21
Option.OPTIONS['dry-run'] = Option('dry-run',
27
25
"""Remove unwanted files from working tree.
28
26
Normally, ignored files are left alone.
30
takes_options = ['ignored', 'detritus', 'dry-run']
31
def run(self, ignored=False, detritus=False, dry_run=False):
28
takes_options = ['ignored', 'detrius', 'dry-run']
29
def run(self, ignored=False, detrius=False, dry_run=False):
32
30
from clean_tree import clean_tree
33
clean_tree('.', ignored=ignored, detritus=detritus, dry_run=dry_run)
31
clean_tree('.', ignored=ignored, detrius=detrius, dry_run=dry_run)
35
33
Option.OPTIONS['no-collapse'] = Option('no-collapse')
36
34
Option.OPTIONS['no-antialias'] = Option('no-antialias')
87
85
aliases = ['fetch-missing']
88
86
takes_args = ['branch?']
89
takes_options = [Option('no-fix')]
90
def run(self, branch=None, no_fix=False):
87
def run(self, branch=None):
91
88
from fetch_ghosts import fetch_ghosts
92
fetch_ghosts(branch, no_fix)
94
91
strip_help="""Strip the smallest prefix containing num leading slashes from \
95
92
each file name found in the patch file."""
142
139
return s.unshelve()
144
141
class cmd_shell(bzrlib.commands.Command):
145
"""Begin an interactive shell tailored for bzr.
146
Bzr commands can be used without typing bzr first, and will be run natively
147
when possible. Tab completion is tailored for bzr. The shell prompt shows
148
the branch nick, revno, and path.
150
If it encounters any moderately complicated shell command, it will punt to
155
bzr bzrtools:287/> status
158
bzr bzrtools:287/> status --[TAB][TAB]
159
--all --help --revision --show-ids
160
bzr bzrtools:287/> status --
164
return shell.run_shell()
166
146
commands = [cmd_shelve, cmd_unshelve, cmd_clean_tree, cmd_graph_ancestry,
167
cmd_fetch_ghosts, cmd_patch, cmd_shell, cmd_fix]
169
command_decorators = []
171
command_decorators = []
147
cmd_fetch_ghosts, cmd_patch, cmd_shell]
173
149
import bzrlib.builtins
174
150
if not hasattr(bzrlib.builtins, "cmd_annotate"):
175
151
commands.append(annotate.cmd_annotate)
176
152
if not hasattr(bzrlib.builtins, "cmd_push"):
177
153
commands.append(push.cmd_push)
179
command_decorators.append(push.cmd_push)
181
155
from errors import NoPyBaz
183
157
import baz_import
184
commands.append(baz_import.cmd_baz_import_branch)
185
158
commands.append(baz_import.cmd_baz_import)
193
166
print "This command is disabled. Please install PyBaz."
194
167
commands.append(cmd_baz_import)
197
169
if hasattr(bzrlib.commands, 'register_command'):
198
170
for command in commands:
199
171
bzrlib.commands.register_command(command)
200
for command in command_decorators:
201
command._original_command = bzrlib.commands.register_command(
205
173
def test_suite():
208
174
from doctest import DocTestSuite
209
175
from unittest import TestSuite, TestLoader
210
176
import clean_tree
213
179
result = TestSuite()
214
180
result.addTest(DocTestSuite(bzrtools))
215
181
result.addTest(clean_tree.test_suite())
216
result.addTest(DocTestSuite(baz_import))
217
result.addTest(tests.test_suite())
218
182
result.addTest(TestLoader().loadTestsFromModule(shelf_tests))
219
183
result.addTest(blackbox.test_suite())