~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Marius Kruger
  • Date: 2007-04-18 20:12:15 UTC
  • mto: This revision was merged to the branch mainline in revision 2455.
  • Revision ID: amanic@gmail.com-20070418201215-upzz7pof6a4433n7
* Minor text fixes.
* Remove trailing whitespace added by this branch.
* Add tests for removing empty directories.
* workingtree.remove
  - Don't recurse into empty directories.
  - Use absolute path when deleting from the file system.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1070
1070
    delete them if they can easily be recovered using revert.
1071
1071
 
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.
1076
1076
    """
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'
1089
1090
 
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)
1093
1094
 
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')
1109
1110
 
1110
1111