~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/index.py

  • Committer: Martin
  • Date: 2010-04-14 00:11:32 UTC
  • mto: This revision was merged to the branch mainline in revision 5164.
  • Revision ID: gzlist@googlemail.com-20100414001132-6m1ru11mbfu87x6m
Fix os.utime test failures, three on FAT filesystems and one with readonly files

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
1425
1421
        hit_names = self._move_to_front_by_index(hit_indices)
1426
1422
        for sibling_idx in self._sibling_indices:
1427
1423
            sibling_idx._move_to_front_by_name(hit_names)
1435
1431
        if 'index' in debug.debug_flags:
1436
1432
            mutter('CombinedGraphIndex reordering: currently %r, promoting %r',
1437
1433
                   indices_info, hit_indices)
 
1434
        hit_indices_info = []
1438
1435
        hit_names = []
1439
 
        unhit_names = []
1440
 
        new_hit_indices = []
1441
 
        unhit_indices = []
1442
 
 
1443
 
        for offset, (name, idx) in enumerate(indices_info):
 
1436
        unhit_indices_info = []
 
1437
        for name, idx in indices_info:
1444
1438
            if idx in hit_indices:
 
1439
                info = hit_indices_info
1445
1440
                hit_names.append(name)
1446
 
                new_hit_indices.append(idx)
1447
 
                if len(new_hit_indices) == len(hit_indices):
1448
 
                    # We've found all of the hit entries, everything else is
1449
 
                    # unhit
1450
 
                    unhit_names.extend(self._index_names[offset+1:])
1451
 
                    unhit_indices.extend(self._indices[offset+1:])
1452
 
                    break
1453
1441
            else:
1454
 
                unhit_names.append(name)
1455
 
                unhit_indices.append(idx)
1456
 
 
1457
 
        self._indices = new_hit_indices + unhit_indices
1458
 
        self._index_names = hit_names + unhit_names
 
1442
                info = unhit_indices_info
 
1443
            info.append((name, idx))
 
1444
        final_info = hit_indices_info + unhit_indices_info
 
1445
        self._indices = [idx for (name, idx) in final_info]
 
1446
        self._index_names = [name for (name, idx) in final_info]
1459
1447
        if 'index' in debug.debug_flags:
1460
1448
            mutter('CombinedGraphIndex reordered: %r', self._indices)
1461
1449
        return hit_names