~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

Merge bzr.dev

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
89
91
    """I report on progress of a commit."""
90
92
 
91
93
    def started(self, revno, revid, location=None):
 
94
        if location is None:
 
95
            symbol_versioning.warn("As of bzr 1.0 you must pass a location "
 
96
                                   "to started.", DeprecationWarning,
 
97
                                   stacklevel=2)
92
98
        pass
93
99
 
94
100
    def snapshot_change(self, change, path):
131
137
 
132
138
    def started(self, revno, rev_id, location=None):
133
139
        if location is not None:
134
 
            location = ' to "' + unescape_for_display(location, 'utf-8') + '"'
 
140
            location = ' to: ' + unescape_for_display(location, 'utf-8')
135
141
        else:
 
142
            # When started was added, location was only made optional by
 
143
            # accident.  Matt Nordhoff 20071129
 
144
            symbol_versioning.warn("As of bzr 1.0 you must pass a location "
 
145
                                   "to started.", DeprecationWarning,
 
146
                                   stacklevel=2)
136
147
            location = ''
137
 
        self._note('Committing revision %d%s.', revno, location)
 
148
        self._note('Committing%s', location)
138
149
 
139
150
    def completed(self, revno, rev_id):
140
151
        self._note('Committed revision %d.', revno)
694
705
               
695
706
        report_changes = self.reporter.is_verbose()
696
707
        deleted_ids = []
697
 
        deleted_paths = set()
 
708
        # A tree of paths that have been deleted. E.g. if foo/bar has been
 
709
        # deleted, then we have {'foo':{'bar':{}}}
 
710
        deleted_paths = {}
698
711
        # XXX: Note that entries may have the wrong kind because the entry does
699
712
        # not reflect the status on disk.
700
713
        work_inv = self.work_tree.inventory
708
721
            if kind == 'directory':
709
722
                self._next_progress_entry()
710
723
            # 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
 
724
            # The deleted path ids are also recorded so they can be explicitly
 
725
            # unversioned later.
 
726
            if deleted_paths:
 
727
                path_segments = splitpath(path)
 
728
                deleted_dict = deleted_paths
 
729
                for segment in path_segments:
 
730
                    deleted_dict = deleted_dict.get(segment, None)
 
731
                    if not deleted_dict:
 
732
                        # We either took a path not present in the dict
 
733
                        # (deleted_dict was None), or we've reached an empty
 
734
                        # child dir in the dict, so are now 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
717
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.
718
744
            if not specific_files or is_inside_any(specific_files, path):
719
745
                if content_summary[0] == 'missing':
720
 
                    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, {})
721
752
                    self.reporter.missing(path)
722
753
                    deleted_ids.append(file_id)
723
754
                    continue