~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/dirstate.py

Fix the remaining 'edge' references.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1566
1566
            return
1567
1567
        id_index = self._get_id_index()
1568
1568
        for file_id in new_ids:
1569
 
            for key in id_index.get(file_id, []):
 
1569
            for key in id_index.get(file_id, ()):
1570
1570
                block_i, entry_i, d_present, f_present = \
1571
1571
                    self._get_block_entry_index(key[0], key[1], tree_index)
1572
1572
                if not f_present:
1980
1980
                                          ' tree_index, file_id and path')
1981
1981
            return entry
1982
1982
        else:
1983
 
            possible_keys = self._get_id_index().get(fileid_utf8, None)
 
1983
            possible_keys = self._get_id_index().get(fileid_utf8, ())
1984
1984
            if not possible_keys:
1985
1985
                return None, None
1986
1986
            for key in possible_keys:
2785
2785
                    # loop.
2786
2786
                    other_entry = other_block[other_entry_index]
2787
2787
                    other_entry[1][0] = ('r', path_utf8, 0, False, '')
2788
 
                    self._maybe_remove_row(other_block, other_entry_index,
2789
 
                        id_index)
 
2788
                    if self._maybe_remove_row(other_block, other_entry_index,
 
2789
                                              id_index):
 
2790
                        # If the row holding this was removed, we need to
 
2791
                        # recompute where this entry goes
 
2792
                        entry_index, _ = self._find_entry_index(key, block)
2790
2793
 
2791
2794
                # This loop:
2792
2795
                # adds a tuple to the new details for each column
2833
2836
            # converted to relocated.
2834
2837
            if path_utf8 is None:
2835
2838
                raise AssertionError('no path')
2836
 
            for entry_key in id_index.setdefault(key[2], set()):
 
2839
            for entry_key in id_index.get(key[2], ()):
2837
2840
                # TODO:PROFILING: It might be faster to just update
2838
2841
                # rather than checking if we need to, and then overwrite
2839
2842
                # the one we are located at.
2863
2866
        """Remove index if it is absent or relocated across the row.
2864
2867
        
2865
2868
        id_index is updated accordingly.
 
2869
        :return: True if we removed the row, False otherwise
2866
2870
        """
2867
2871
        present_in_row = False
2868
2872
        entry = block[index]
2873
2877
        if not present_in_row:
2874
2878
            block.pop(index)
2875
2879
            id_index[entry[0][2]].remove(entry[0])
 
2880
            return True
 
2881
        return False
2876
2882
 
2877
2883
    def _validate(self):
2878
2884
        """Check that invariants on the dirblock are correct.