~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/dirstate.py

Fix Dirstate unversioning of entries which are in a parent.

Show diffs side-by-side

added added

removed removed

Lines of Context:
215
215
            raise errors.BzrError('unknown kind %r' % kind)
216
216
        row_index = bisect.bisect_left(block, row_data)
217
217
        if len(block) > row_index:
218
 
            assert block[row_index][1] != basename, \
 
218
            assert block[row_index][0][1] != basename, \
219
219
                "basename %r already added" % basename
220
220
        block.insert(row_index, row_data)
221
221
 
224
224
           bisect.insort_left(self._dirblocks, (utf8path, []))
225
225
        self._dirblock_state = DirState.IN_MEMORY_MODIFIED
226
226
 
 
227
    def add_deleted(self, fileid_utf8, parents):
 
228
        """Add fileid_utf8 with parents as deleted."""
 
229
        self._read_dirblocks_if_needed()
 
230
        new_row = self._make_deleted_row(fileid_utf8, parents)
 
231
        block_index = self._find_dirblock_index(new_row[0][0])
 
232
        if block_index < 0:
 
233
            # no deleted block yet.
 
234
            bisect.insort_left(self._dirblocks, (new_row[0][0], []))
 
235
            block_index = self._find_dirblock_index(new_row[0][0])
 
236
        block = self._dirblocks[block_index][1]
 
237
        row_index = bisect.insort_left(block, new_row)
 
238
        self._dirblock_state = DirState.IN_MEMORY_MODIFIED
 
239
 
227
240
    def add_parent_tree(self, tree_id, tree):
228
241
        """Add tree as a parent to this dirstate."""
229
242
        self._read_dirblocks_if_needed()
429
442
        output_lines.append(inventory_text)
430
443
        return output_lines
431
444
 
 
445
    def _make_deleted_row(self, fileid_utf8, parents):
 
446
        """Return a deleted for for fileid_utf8."""
 
447
        return ('/', 'RECYCLED.BIN', 'file', fileid_utf8, 0, DirState.NULLSTAT,
 
448
            ''), parents
 
449
 
432
450
    @staticmethod
433
451
    def on_file(path):
434
452
        """Construct a DirState on the file at path path."""