~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/dirstate.py

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, ())
 
1983
            possible_keys = self._get_id_index().get(fileid_utf8, None)
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
 
                    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)
 
2788
                    self._maybe_remove_row(other_block, other_entry_index,
 
2789
                        id_index)
2793
2790
 
2794
2791
                # This loop:
2795
2792
                # adds a tuple to the new details for each column
2836
2833
            # converted to relocated.
2837
2834
            if path_utf8 is None:
2838
2835
                raise AssertionError('no path')
2839
 
            for entry_key in id_index.get(key[2], ()):
 
2836
            for entry_key in id_index.setdefault(key[2], set()):
2840
2837
                # TODO:PROFILING: It might be faster to just update
2841
2838
                # rather than checking if we need to, and then overwrite
2842
2839
                # the one we are located at.
2866
2863
        """Remove index if it is absent or relocated across the row.
2867
2864
        
2868
2865
        id_index is updated accordingly.
2869
 
        :return: True if we removed the row, False otherwise
2870
2866
        """
2871
2867
        present_in_row = False
2872
2868
        entry = block[index]
2877
2873
        if not present_in_row:
2878
2874
            block.pop(index)
2879
2875
            id_index[entry[0][2]].remove(entry[0])
2880
 
            return True
2881
 
        return False
2882
2876
 
2883
2877
    def _validate(self):
2884
2878
        """Check that invariants on the dirblock are correct.