/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« 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:
462
462
        trailers = 0
463
463
        pos = stream.tell()
464
464
        lines = stream.read().split('\n')
465
 
        # GZ 2009-09-20: Should really use a try/finally block to ensure close
466
465
        stream.close()
467
466
        del lines[-1]
468
467
        _, _, _, trailers = self._parse_lines(lines, pos)
1419
1418
        _move_to_front propagates to all objects in self._sibling_indices by
1420
1419
        calling _move_to_front_by_name.
1421
1420
        """
1422
 
        if self._indices[:len(hit_indices)] == hit_indices:
1423
 
            # The 'hit_indices' are already at the front (and in the same
1424
 
            # order), no need to re-order
1425
 
            return
1426
1421
        hit_names = self._move_to_front_by_index(hit_indices)
1427
1422
        for sibling_idx in self._sibling_indices:
1428
1423
            sibling_idx._move_to_front_by_name(hit_names)
1436
1431
        if 'index' in debug.debug_flags:
1437
1432
            mutter('CombinedGraphIndex reordering: currently %r, promoting %r',
1438
1433
                   indices_info, hit_indices)
 
1434
        hit_indices_info = []
1439
1435
        hit_names = []
1440
 
        unhit_names = []
1441
 
        new_hit_indices = []
1442
 
        unhit_indices = []
1443
 
 
1444
 
        for offset, (name, idx) in enumerate(indices_info):
 
1436
        unhit_indices_info = []
 
1437
        for name, idx in indices_info:
1445
1438
            if idx in hit_indices:
 
1439
                info = hit_indices_info
1446
1440
                hit_names.append(name)
1447
 
                new_hit_indices.append(idx)
1448
 
                if len(new_hit_indices) == len(hit_indices):
1449
 
                    # We've found all of the hit entries, everything else is
1450
 
                    # unhit
1451
 
                    unhit_names.extend(self._index_names[offset+1:])
1452
 
                    unhit_indices.extend(self._indices[offset+1:])
1453
 
                    break
1454
1441
            else:
1455
 
                unhit_names.append(name)
1456
 
                unhit_indices.append(idx)
1457
 
 
1458
 
        self._indices = new_hit_indices + unhit_indices
1459
 
        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]
1460
1447
        if 'index' in debug.debug_flags:
1461
1448
            mutter('CombinedGraphIndex reordered: %r', self._indices)
1462
1449
        return hit_names