1070
1070
delete them if they can easily be recovered using revert.
1072
1072
You can specify one or more files, and/or --new. If you specify --new,
1073
only 'added' files will be removed. If you specify both, then new files
1073
only 'added' files will be removed. If you specify both, then new files
1074
1074
in the specified directories will be removed. If the directories are
1075
1075
also new, they will also be removed.
1077
1077
takes_args = ['file*']
1078
takes_options = ['verbose',
1078
takes_options = ['verbose',
1079
1079
Option('new', help='remove newly-added files'),
1080
1080
RegistryOption.from_kwargs('file-deletion-strategy',
1081
1081
'The file deletion mode to be used',
1082
1082
title='Deletion Strategy', value_switches=True, enum_switch=False,
1083
safe='Only delete files if they can be safely recovered (default).',
1083
safe='Only delete files if they can be'
1084
' safely recovered (default).',
1084
1085
keep="Don't delete any files.",
1085
1086
force='Delete all the specified files, even if they can not be '
1086
1087
'recovered and even if they are non-empty directories.')]
1087
1088
aliases = ['rm']
1088
1089
encoding_type = 'replace'
1090
def run(self, file_list, verbose=False, new=False,
1091
def run(self, file_list, verbose=False, new=False,
1091
1092
file_deletion_strategy='safe'):
1092
1093
tree, file_list = tree_files(file_list)
1104
1105
if len(file_list) == 0:
1105
1106
raise errors.BzrCommandError('No matching files.')
1106
1107
tree.remove(file_list, verbose=verbose, to_file=self.outf,
1107
keep_files=file_deletion_strategy=='keep',
1108
keep_files=file_deletion_strategy=='keep',
1108
1109
force=file_deletion_strategy=='force')