~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

(spiv) Fix edge cases in handling interrupts during _rename_in_limbo.
 (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1154
1154
        self._deletiondir = None
1155
1155
        # A mapping of transform ids to their limbo filename
1156
1156
        self._limbo_files = {}
 
1157
        self._possibly_stale_limbo_files = set()
1157
1158
        # A mapping of transform ids to a set of the transform ids of children
1158
1159
        # that their limbo directory has
1159
1160
        self._limbo_children = {}
1172
1173
        if self._tree is None:
1173
1174
            return
1174
1175
        try:
1175
 
            limbo_paths = sorted(self._limbo_files.values(), reverse=True)
 
1176
            limbo_paths = self._limbo_files.values() + list(
 
1177
                self._possibly_stale_limbo_files)
 
1178
            limbo_paths = sorted(limbo_paths, reverse=True)
1176
1179
            for path in limbo_paths:
1177
1180
                try:
1178
1181
                    delete_any(path)
1236
1239
        entries from _limbo_files, because they are now stale.
1237
1240
        """
1238
1241
        for trans_id in trans_ids:
1239
 
            old_path = self._limbo_files.pop(trans_id)
 
1242
            old_path = self._limbo_files[trans_id]
 
1243
            self._possibly_stale_limbo_files.add(old_path)
 
1244
            del self._limbo_files[trans_id]
1240
1245
            if trans_id not in self._new_contents:
1241
1246
                continue
1242
1247
            new_path = self._limbo_name(trans_id)
1243
1248
            os.rename(old_path, new_path)
 
1249
            self._possibly_stale_limbo_files.remove(old_path)
1244
1250
            for descendant in self._limbo_descendants(trans_id):
1245
1251
                desc_path = self._limbo_files[descendant]
1246
1252
                desc_path = new_path + desc_path[len(old_path):]