/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/dirstate.py

  • Committer: Robert Collins
  • Date: 2007-03-01 11:16:53 UTC
  • mto: (2255.11.3 dirstate)
  • mto: This revision was merged to the branch mainline in revision 2322.
  • Revision ID: robertc@robertcollins.net-20070301111653-xz97hibpktk2y5co
Test adding of roots to trees, it was broken on WorkingTree4.

Show diffs side-by-side

added added

removed removed

Lines of Context:
331
331
            kind = DirState._minikind_to_kind[file_id_entry[1][0][0]]
332
332
            info = '%s:%s' % (kind, path)
333
333
            raise errors.DuplicateFileId(file_id, info)
334
 
        entry_key = (dirname, basename, file_id)
335
 
        self._read_dirblocks_if_needed()
336
 
        block_index, present = self._find_block_index_from_key(entry_key)
337
 
        if not present:
 
334
        first_key = (dirname, basename, '')
 
335
        block_index, present = self._find_block_index_from_key(first_key)
 
336
        if present:
 
337
            # check the path is not in the tree
 
338
            block = self._dirblocks[block_index][1]
 
339
            entry_index, _ = self._find_entry_index(first_key, block)
 
340
            while (entry_index < len(block) and 
 
341
                block[entry_index][0][0:2] == first_key[0:2]):
 
342
                if block[entry_index][1][0][0] not in 'ar':
 
343
                    # this path is in the dirstate in the current tree.
 
344
                    raise Exception, "adding already added path!"
 
345
        else:
338
346
            # The block where we want to put the file is not present. But it
339
347
            # might be because the directory was empty, or not loaded yet. Look
340
348
            # for a parent entry, if not found, raise NotVersionedError
345
353
                raise errors.NotVersionedError(path, str(self))
346
354
            self._ensure_block(parent_block_idx, parent_entry_idx, dirname)
347
355
        block = self._dirblocks[block_index][1]
 
356
        entry_key = (dirname, basename, file_id)
348
357
        if stat is None:
349
358
            size = 0
350
359
            packed_stat = DirState.NULLSTAT