/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: Robert Collins
  • Date: 2008-02-06 04:06:42 UTC
  • mfrom: (3216 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3217.
  • Revision ID: robertc@robertcollins.net-20080206040642-2efx3l4iv5f95lxp
Merge up with bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
36
37
""")
37
 
from bzrlib import debug, errors
 
38
from bzrlib import (
 
39
    debug,
 
40
    errors,
 
41
    symbol_versioning,
 
42
    )
38
43
 
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)))
996
1001
 
 
1002
    @symbol_versioning.deprecated_method(symbol_versioning.one_one)
 
1003
    def get_parents(self, revision_ids):
 
1004
        """See graph._StackedParentsProvider.get_parents.
 
1005
        
 
1006
        This implementation thunks the graph.Graph.get_parents api across to
 
1007
        GraphIndex.
 
1008
 
 
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.
 
1015
        """
 
1016
        parent_map = self.get_parent_map(revision_ids)
 
1017
        return [parent_map.get(r, None) for r in revision_ids]
 
1018
 
 
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:[]}
 
1025
        else:
 
1026
            found_parents = {}
 
1027
        for index, key, value, refs in self.iter_entries(search_keys):
 
1028
            parents = refs[0]
 
1029
            if not parents:
 
1030
                parents = (NULL_REVISION,)
 
1031
            found_parents[key] = parents
 
1032
        return found_parents
 
1033
 
997
1034
    def insert_index(self, pos, index):
998
1035
        """Insert a new index in the list of indices to query.
999
1036
 
1128
1165
        """Iterate over keys within the index.
1129
1166
 
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).
1134
1171
        """
1312
1349
        """Iterate over keys within the index.
1313
1350
 
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).
1318
1355
        """