71
71
from bzrlib.osutils import (kind_marker, isdir,isfile, is_inside_any,
72
72
is_inside_or_parent_of_any,
73
73
minimum_path_selection,
74
quotefn, sha_file, split_lines)
74
quotefn, sha_file, split_lines,
75
77
from bzrlib.testament import Testament
76
78
from bzrlib.trace import mutter, note, warning, is_quiet
77
79
from bzrlib.xml5 import serializer_v5
695
697
report_changes = self.reporter.is_verbose()
697
deleted_paths = set()
699
# A tree of paths that have been deleted. E.g. if foo/bar has been
700
# deleted, then we have {'foo':{'bar':{}}}
698
702
# XXX: Note that entries may have the wrong kind because the entry does
699
703
# not reflect the status on disk.
700
704
work_inv = self.work_tree.inventory
708
712
if kind == 'directory':
709
713
self._next_progress_entry()
710
714
# Skip files that have been deleted from the working tree.
711
# The deleted files/directories are also recorded so they
712
# can be explicitly unversioned later. Note that when a
713
# filter of specific files is given, we must only skip/record
714
# deleted files matching that filter.
715
if is_inside_any(deleted_paths, path):
715
# The deleted path ids are also recorded so they can be explicitly
718
path_segments = splitpath(path)
719
deleted_dict = deleted_paths
720
for segment in path_segments:
721
deleted_dict = deleted_dict.get(segment, None)
723
# We either took a path not present in the dict
724
# (deleted_dict was None), or we've reached an empty
725
# child dir in the dict, so are now a sub-path.
729
if deleted_dict is not None:
730
# the path has a deleted parent, do not add it.
717
732
content_summary = self.work_tree.path_content_summary(path)
733
# Note that when a filter of specific files is given, we must only
734
# skip/record deleted files matching that filter.
718
735
if not specific_files or is_inside_any(specific_files, path):
719
736
if content_summary[0] == 'missing':
720
deleted_paths.add(path)
737
if not deleted_paths:
738
# path won't have been split yet.
739
path_segments = splitpath(path)
740
deleted_dict = deleted_paths
741
for segment in path_segments:
742
deleted_dict = deleted_dict.setdefault(segment, {})
721
743
self.reporter.missing(path)
722
744
deleted_ids.append(file_id)