/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: Robert Collins
  • Date: 2007-10-24 22:37:42 UTC
  • mto: (2592.6.7 repository)
  • mto: This revision was merged to the branch mainline in revision 3034.
  • Revision ID: robertc@robertcollins.net-20071024223742-fhjlj7l6lu77s9zq
* Commit with many automatically found deleted paths no longer performs
  linear scanning for the children of those paths during inventory
  iteration. This should fix commit performance blowing out when many such
  paths occur during commit. (Robert Collins, #156491)

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
703
705
               
704
706
        report_changes = self.reporter.is_verbose()
705
707
        deleted_ids = []
706
 
        deleted_paths = set()
 
708
        deleted_paths = {}
707
709
        # XXX: Note that entries may have the wrong kind because the entry does
708
710
        # not reflect the status on disk.
709
711
        work_inv = self.work_tree.inventory
717
719
            if kind == 'directory':
718
720
                self._next_progress_entry()
719
721
            # Skip files that have been deleted from the working tree.
720
 
            # The deleted files/directories are also recorded so they
721
 
            # can be explicitly unversioned later. Note that when a
722
 
            # filter of specific files is given, we must only skip/record
723
 
            # deleted files matching that filter.
724
 
            if is_inside_any(deleted_paths, path):
725
 
                continue
 
722
            # The deleted path ids are also recorded so they can be explicitly
 
723
            # unversioned later.
 
724
            if deleted_paths:
 
725
                path_segments = splitpath(path)
 
726
                deleted_dict = deleted_paths
 
727
                for segment in path_segments:
 
728
                    deleted_dict = deleted_dict.get(segment, None)
 
729
                    if deleted_dict is None:
 
730
                        # We took a path not present in the dict.
 
731
                        break
 
732
                    if not deleted_dict:
 
733
                        # We've reached an empty child dir in the dict, so are now
 
734
                        # a sub-path.
 
735
                        break
 
736
                else:
 
737
                    deleted_dict = None
 
738
                if deleted_dict is not None:
 
739
                    # the path has a deleted parent, do not add it.
 
740
                    continue
726
741
            content_summary = self.work_tree.path_content_summary(path)
 
742
            # Note that when a filter of specific files is given, we must only
 
743
            # skip/record deleted files matching that filter.
727
744
            if not specific_files or is_inside_any(specific_files, path):
728
745
                if content_summary[0] == 'missing':
729
 
                    deleted_paths.add(path)
 
746
                    if not deleted_paths:
 
747
                        # path won't have been split yet.
 
748
                        path_segments = splitpath(path)
 
749
                    deleted_dict = deleted_paths
 
750
                    for segment in path_segments:
 
751
                        deleted_dict = deleted_dict.setdefault(segment, {})
730
752
                    self.reporter.missing(path)
731
753
                    deleted_ids.append(file_id)
732
754
                    continue