/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

  • Committer: Michael Hudson
  • Date: 2007-11-29 18:58:23 UTC
  • mfrom: (3048 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3189.
  • Revision ID: michael.hudson@canonical.com-20071129185823-vpokl0unnsjib0xw
merge bzr.dev
a bit involved, hope i got it all right!

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
                            splitpath,
 
76
                            )
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
694
696
               
695
697
        report_changes = self.reporter.is_verbose()
696
698
        deleted_ids = []
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':{}}}
 
701
        deleted_paths = {}
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):
716
 
                continue
 
715
            # The deleted path ids are also recorded so they can be explicitly
 
716
            # unversioned later.
 
717
            if deleted_paths:
 
718
                path_segments = splitpath(path)
 
719
                deleted_dict = deleted_paths
 
720
                for segment in path_segments:
 
721
                    deleted_dict = deleted_dict.get(segment, None)
 
722
                    if not deleted_dict:
 
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.
 
726
                        break
 
727
                else:
 
728
                    deleted_dict = None
 
729
                if deleted_dict is not None:
 
730
                    # the path has a deleted parent, do not add it.
 
731
                    continue
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)
723
745
                    continue