~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/index.py

  • Committer: John Arbash Meinel
  • Date: 2010-04-14 04:26:53 UTC
  • mto: (5050.3.1 2.2)
  • mto: This revision was merged to the branch mainline in revision 5157.
  • Revision ID: john@arbash-meinel.com-20100414042653-gpn4fv8ahpb4x7gv
Avoid reordering when unnecessary. Fixes bug #562429

The existing code would do a full iteration over all pack indexes (for all of
rix/iix/tix/cix/six), just to generate a list that was in the same order.
Instead, we now only trigger a re-order when we know something has
changed in the local index.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1418
1418
        _move_to_front propagates to all objects in self._sibling_indices by
1419
1419
        calling _move_to_front_by_name.
1420
1420
        """
 
1421
        if self._indices[:len(hit_indices)] == hit_indices:
 
1422
            # The 'hit_indices' are already at the front (and in the same
 
1423
            # order), no need to re-order
 
1424
            return
1421
1425
        hit_names = self._move_to_front_by_index(hit_indices)
1422
1426
        for sibling_idx in self._sibling_indices:
1423
1427
            sibling_idx._move_to_front_by_name(hit_names)