32
32
lazy_import(globals(), """
33
33
from bzrlib import trace
34
34
from bzrlib.bisect_multi import bisect_multi_bytes
35
from bzrlib.revision import NULL_REVISION
35
36
from bzrlib.trace import mutter
37
from bzrlib import debug, errors
39
44
_HEADER_READV = (0, 200)
40
45
_OPTION_KEY_ELEMENTS = "key_elements="
994
999
self.__class__.__name__,
995
1000
', '.join(map(repr, self._indices)))
1002
@symbol_versioning.deprecated_method(symbol_versioning.one_one)
1003
def get_parents(self, revision_ids):
1004
"""See graph._StackedParentsProvider.get_parents.
1006
This implementation thunks the graph.Graph.get_parents api across to
1009
:param revision_ids: An iterable of graph keys for this graph.
1010
:return: A list of parent details for each key in revision_ids.
1011
Each parent details will be one of:
1012
* None when the key was missing
1013
* (NULL_REVISION,) when the key has no parents.
1014
* (parent_key, parent_key...) otherwise.
1016
parent_map = self.get_parent_map(revision_ids)
1017
return [parent_map.get(r, None) for r in revision_ids]
1019
def get_parent_map(self, keys):
1020
"""See graph._StackedParentsProvider.get_parent_map"""
1021
search_keys = set(keys)
1022
if NULL_REVISION in search_keys:
1023
search_keys.discard(NULL_REVISION)
1024
found_parents = {NULL_REVISION:[]}
1027
for index, key, value, refs in self.iter_entries(search_keys):
1030
parents = (NULL_REVISION,)
1031
found_parents[key] = parents
1032
return found_parents
997
1034
def insert_index(self, pos, index):
998
1035
"""Insert a new index in the list of indices to query.
1128
1165
"""Iterate over keys within the index.
1130
1167
:param keys: An iterable providing the keys to be retrieved.
1131
:return: An iterable of (index, key, reference_lists, value). There is no
1168
:return: An iterable of (index, key, value, reference_lists). There is no
1132
1169
defined order for the result iteration - it will be in the most
1133
1170
efficient order for the index (keys iteration order in this case).
1312
1349
"""Iterate over keys within the index.
1314
1351
:param keys: An iterable providing the keys to be retrieved.
1315
:return: An iterable of (key, reference_lists, value). There is no
1352
:return: An iterable of (index, key, value, reference_lists). There is no
1316
1353
defined order for the result iteration - it will be in the most
1317
1354
efficient order for the index (keys iteration order in this case).