1076
1076
class cmd_remove(Command):
1077
"""Make a file unversioned.
1077
"""Remove files or directories.
1079
This makes bzr stop tracking changes to a versioned file. It does
1080
not delete the working copy.
1079
This makes bzr stop tracking changes to the specified files and
1080
delete them if they can easily be recovered using revert.
1082
1082
You can specify one or more files, and/or --new. If you specify --new,
1083
1083
only 'added' files will be removed. If you specify both, then new files
1085
1085
also new, they will also be removed.
1087
1087
takes_args = ['file*']
1088
takes_options = ['verbose', Option('new', help='remove newly-added files')]
1088
takes_options = ['verbose',
1089
Option('new', help='remove newly-added files'),
1090
RegistryOption.from_kwargs('file-deletion-strategy',
1091
'The file deletion mode to be used',
1092
title='Deletion Strategy', value_switches=True, enum_switch=False,
1093
safe='Only delete files if they can be'
1094
' safely recovered (default).',
1095
keep="Don't delete any files.",
1096
force='Delete all the specified files, even if they can not be '
1097
'recovered and even if they are non-empty directories.')]
1089
1098
aliases = ['rm']
1090
1099
encoding_type = 'replace'
1092
def run(self, file_list, verbose=False, new=False):
1101
def run(self, file_list, verbose=False, new=False,
1102
file_deletion_strategy='safe'):
1093
1103
tree, file_list = tree_files(file_list)
1095
if file_list is None:
1096
raise errors.BzrCommandError('Specify one or more files to'
1097
' remove, or use --new.')
1105
if file_list is not None:
1106
file_list = [f for f in file_list if f != '']
1108
raise errors.BzrCommandError('Specify one or more files to'
1109
' remove, or use --new.')
1099
1112
added = tree.changes_from(tree.basis_tree(),
1100
1113
specific_files=file_list).added
1101
1114
file_list = sorted([f[0] for f in added], reverse=True)
1102
1115
if len(file_list) == 0:
1103
1116
raise errors.BzrCommandError('No matching files.')
1104
tree.remove(file_list, verbose=verbose, to_file=self.outf)
1117
tree.remove(file_list, verbose=verbose, to_file=self.outf,
1118
keep_files=file_deletion_strategy=='keep',
1119
force=file_deletion_strategy=='force')
1107
1122
class cmd_file_id(Command):
2157
2172
# selected-file merge commit is not done yet
2158
2173
selected_list = []
2160
properties['bugs'] = self._get_bug_fix_properties(fixes, tree.branch)
2175
bug_property = self._get_bug_fix_properties(fixes, tree.branch)
2177
properties['bugs'] = bug_property
2162
2179
if local and not tree.branch.get_bound_location():
2163
2180
raise errors.LocalRequiresBoundBranch()
2326
2343
class cmd_selftest(Command):
2327
2344
"""Run internal test suite.
2329
This creates temporary test directories in the working directory, but not
2346
This creates temporary test directories in the working directory, but no
2330
2347
existing data is affected. These directories are deleted if the tests
2331
2348
pass, or left behind to help in debugging if they fail and --keep-output
2339
2356
all other tests are run. This is useful if you have been working in a
2340
2357
particular area, but want to make sure nothing else was broken.
2359
If --exclude is given, tests that match that regular expression are
2360
excluded, regardless of whether they match --first or not.
2362
To help catch accidential dependencies between tests, the --randomize
2363
option is useful. In most cases, the argument used is the word 'now'.
2364
Note that the seed used for the random number generator is displayed
2365
when this option is used. The seed can be explicitly passed as the
2366
argument to this option if required. This enables reproduction of the
2367
actual ordering used if and when an order sensitive problem is encountered.
2369
If --list-only is given, the tests that would be run are listed. This is
2370
useful when combined with --first, --exclude and/or --randomize to
2371
understand their impact. The test harness reports "Listed nn tests in ..."
2372
instead of "Ran nn tests in ..." when list mode is enabled.
2342
2374
If the global option '--no-plugins' is given, plugins are not loaded
2343
2375
before running the selftests. This has two effects: features provided or
2344
2376
modified by plugins will not be tested, and tests provided by plugins will
2357
2389
of running tests to create such subdirectories. This is default behavior
2358
2390
on Windows because of path length limitation.
2360
# TODO: --list should give a list of all available tests
2362
2392
# NB: this is used from the class without creating an instance, which is
2363
2393
# why it does not have a self parameter.
2364
2394
def get_transport_type(typestring):
2406
2436
Option('numbered-dirs',
2407
2437
help='use numbered dirs for TestCaseInTempDir'),
2439
help='list the tests instead of running them'),
2440
Option('randomize', type=str, argname="SEED",
2441
help='randomize the order of tests using the given'
2442
' seed or "now" for the current time'),
2443
Option('exclude', type=str, argname="PATTERN",
2445
help='exclude tests that match this regular'
2409
2448
encoding_type = 'replace'
2411
2450
def run(self, testspecs_list=None, verbose=None, one=False,
2412
2451
keep_output=False, transport=None, benchmark=None,
2413
2452
lsprof_timed=None, cache_dir=None, clean_output=False,
2414
first=False, numbered_dirs=None):
2453
first=False, numbered_dirs=None, list_only=False,
2454
randomize=None, exclude=None):
2415
2455
import bzrlib.ui
2416
2456
from bzrlib.tests import selftest
2417
2457
import bzrlib.benchmarks as benchmarks