2644
2644
# relocations when updating an existing record but its not:
2645
2645
# the test for existing kinds is different: this can be
2646
2646
# factored out to a helper though.
2647
other_block_index, present = self._find_block_index_from_key(other_key)
2647
other_block_index, present = self._find_block_index_from_key(
2648
2649
if not present:
2649
raise AssertionError('could not find block for %s' % (other_key,))
2650
raise AssertionError('could not find block for %s' % (
2650
2652
other_entry_index, present = self._find_entry_index(other_key,
2651
2653
self._dirblocks[other_block_index][1])
2652
2654
if not present:
2653
raise AssertionError('could not find entry for %s' % (other_key,))
2655
raise AssertionError('could not find entry for %s' % (
2654
2657
if path_utf8 is None:
2655
2658
raise AssertionError('no path')
2656
self._dirblocks[other_block_index][1][other_entry_index][1][0] = \
2659
other_block = self._dirblocks[other_block_index][1]
2660
# Turn this other location into a reference to the new
2661
# location. This also updates the aliased iterator that
2662
# set_state_from_inventory uses so that the old entry, if
2663
# not already examined, is skipped over.
2664
other_block[other_entry_index][1][0] = \
2657
2665
('r', path_utf8, 0, False, '')
2666
if len(other_block[other_entry_index][1]) == 1:
2667
# We only have one tree in use, so an 'r' record is not
2668
# needed: remove it.
2669
other_block.pop(other_entry_index)
2659
2671
num_present_parents = self._num_present_parents()
2660
2672
for lookup_index in xrange(1, num_present_parents + 1):