~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/index.py

  • Committer: John Arbash Meinel
  • Date: 2011-05-11 11:35:28 UTC
  • mto: This revision was merged to the branch mainline in revision 5851.
  • Revision ID: john@arbash-meinel.com-20110511113528-qepibuwxicjrbb2h
Break compatibility with python <2.6.

This includes auditing the code for places where we were doing
explicit 'sys.version' checks and removing them as appropriate.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2010 Canonical Ltd
 
1
# Copyright (C) 2007-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
31
31
 
32
32
from bzrlib.lazy_import import lazy_import
33
33
lazy_import(globals(), """
34
 
from bzrlib import trace
35
 
from bzrlib.bisect_multi import bisect_multi_bytes
36
 
from bzrlib.revision import NULL_REVISION
37
 
from bzrlib.trace import mutter
 
34
from bzrlib import (
 
35
    bisect_multi,
 
36
    revision as _mod_revision,
 
37
    trace,
 
38
    )
38
39
""")
39
40
from bzrlib import (
40
41
    debug,
444
445
            # We already did this
445
446
            return
446
447
        if 'index' in debug.debug_flags:
447
 
            mutter('Reading entire index %s', self._transport.abspath(self._name))
 
448
            trace.mutter('Reading entire index %s',
 
449
                          self._transport.abspath(self._name))
448
450
        if stream is None:
449
451
            stream = self._transport.get(self._name)
450
452
            if self._base_offset != 0:
671
673
        if self._nodes is not None:
672
674
            return self._iter_entries_from_total_buffer(keys)
673
675
        else:
674
 
            return (result[1] for result in bisect_multi_bytes(
 
676
            return (result[1] for result in bisect_multi.bisect_multi_bytes(
675
677
                self._lookup_keys_via_location, self._size, keys))
676
678
 
677
679
    def iter_entries_prefix(self, keys):
1288
1290
    def get_parent_map(self, keys):
1289
1291
        """See graph.StackedParentsProvider.get_parent_map"""
1290
1292
        search_keys = set(keys)
1291
 
        if NULL_REVISION in search_keys:
1292
 
            search_keys.discard(NULL_REVISION)
1293
 
            found_parents = {NULL_REVISION:[]}
 
1293
        if _mod_revision.NULL_REVISION in search_keys:
 
1294
            search_keys.discard(_mod_revision.NULL_REVISION)
 
1295
            found_parents = {_mod_revision.NULL_REVISION:[]}
1294
1296
        else:
1295
1297
            found_parents = {}
1296
1298
        for index, key, value, refs in self.iter_entries(search_keys):
1297
1299
            parents = refs[0]
1298
1300
            if not parents:
1299
 
                parents = (NULL_REVISION,)
 
1301
                parents = (_mod_revision.NULL_REVISION,)
1300
1302
            found_parents[key] = parents
1301
1303
        return found_parents
1302
1304
 
1434
1436
        """
1435
1437
        indices_info = zip(self._index_names, self._indices)
1436
1438
        if 'index' in debug.debug_flags:
1437
 
            mutter('CombinedGraphIndex reordering: currently %r, promoting %r',
1438
 
                   indices_info, hit_indices)
 
1439
            trace.mutter('CombinedGraphIndex reordering: currently %r, '
 
1440
                         'promoting %r', indices_info, hit_indices)
1439
1441
        hit_names = []
1440
1442
        unhit_names = []
1441
1443
        new_hit_indices = []
1458
1460
        self._indices = new_hit_indices + unhit_indices
1459
1461
        self._index_names = hit_names + unhit_names
1460
1462
        if 'index' in debug.debug_flags:
1461
 
            mutter('CombinedGraphIndex reordered: %r', self._indices)
 
1463
            trace.mutter('CombinedGraphIndex reordered: %r', self._indices)
1462
1464
        return hit_names
1463
1465
 
1464
1466
    def _move_to_front_by_name(self, hit_names):