##// END OF EJS Templates
rust: hooking into Python code...
Georges Racinet -
r40334:9cadb0f5 default
parent child Browse files
Show More
@@ -11,9 +11,12 b' import heapq'
11 11
12 12 from .node import nullrev
13 13 from . import (
14 policy,
14 15 pycompat,
15 16 )
16 17
18 parsers = policy.importmod(r'parsers')
19
17 20 def commonancestorsheads(pfunc, *nodes):
18 21 """Returns a set with the heads of all common ancestors of all nodes,
19 22 heads(::nodes[0] and ::nodes[1] and ...) .
@@ -379,3 +382,25 b' class lazyancestors(object):'
379 382 # free up memory.
380 383 self._containsiter = None
381 384 return False
385
386 class rustlazyancestors(lazyancestors):
387
388 def __init__(self, index, revs, stoprev=0, inclusive=False):
389 self._index = index
390 self._stoprev = stoprev
391 self._inclusive = inclusive
392 # no need to prefilter out init revs that are smaller than stoprev,
393 # it's done by rustlazyancestors constructor.
394 # we need to convert to a list, because our ruslazyancestors
395 # constructor (from C code) doesn't understand anything else yet
396 self._initrevs = initrevs = list(revs)
397
398 self._containsseen = set()
399 self._containsiter = parsers.rustlazyancestors(
400 index, initrevs, stoprev, inclusive)
401
402 def __iter__(self):
403 return parsers.rustlazyancestors(self._index,
404 self._initrevs,
405 self._stoprev,
406 self._inclusive)
@@ -763,6 +763,10 b' class revlog(object):'
763 763 for r in revs:
764 764 checkrev(r)
765 765 # and we're sure ancestors aren't filtered as well
766 if util.safehasattr(parsers, 'rustlazyancestors'):
767 return ancestor.rustlazyancestors(
768 self.index, revs,
769 stoprev=stoprev, inclusive=inclusive)
766 770 return ancestor.lazyancestors(self._uncheckedparentrevs, revs,
767 771 stoprev=stoprev, inclusive=inclusive)
768 772
General Comments 0
You need to be logged in to leave comments. Login now