1767
1767
@needs_tree_write_lock
1768
1768
def remove(self, files, verbose=False, to_file=None, keep_files=True,
1770
"""Remove nominated files from the working inventor.
1770
"""Remove nominated files from the working inventory.
1772
1772
:files: File paths relative to the basedir.
1773
1773
:keep_files: If true, the files will also be kept.
1808
1808
recurse_directory_to_add_files(filename)
1809
1809
files = [f for f in new_files]
1812
return # nothing to do
1811
1814
# Sort needed to first handle directory content before the directory
1812
1815
files.sort(reverse=True)
1813
1816
if not keep_files and not force:
1814
tree_delta = self.changes_from(self.basis_tree(),
1815
specific_files=files)
1816
for unknown_file in unknown_files_in_directory:
1817
tree_delta.unversioned.extend((unknown_file,))
1818
if bool(tree_delta.modified
1820
or tree_delta.renamed
1821
or tree_delta.kind_changed
1822
or tree_delta.unversioned):
1817
has_changed_files = len(unknown_files_in_directory) > 0
1818
if not has_changed_files:
1819
for (file_id, path, content_change, versioned, parent_id, name,
1820
kind, executable) in self._iter_changes(self.basis_tree(),
1821
include_unchanged=True, require_versioned=False,
1822
want_unversioned=True, specific_files=files):
1823
# check if it's unknown OR changed but not deleted:
1824
if (versioned == (False, False)
1825
or (content_change and kind[1] != None)):
1826
has_changed_files = True
1829
if has_changed_files:
1830
# make delta to show ALL applicable changes in error message.
1831
tree_delta = self.changes_from(self.basis_tree(),
1832
specific_files=files)
1833
for unknown_file in unknown_files_in_directory:
1834
tree_delta.unversioned.extend((unknown_file,))
1823
1835
raise errors.BzrRemoveChangedFilesError(tree_delta)
1825
1837
# do this before any modifications