equal
deleted
inserted
replaced
9 |
9 |
10 import heapq |
10 import heapq |
11 |
11 |
12 from .node import nullrev |
12 from .node import nullrev |
13 from . import ( |
13 from . import ( |
|
14 policy, |
14 pycompat, |
15 pycompat, |
15 ) |
16 ) |
|
17 |
|
18 parsers = policy.importmod(r'parsers') |
16 |
19 |
17 def commonancestorsheads(pfunc, *nodes): |
20 def commonancestorsheads(pfunc, *nodes): |
18 """Returns a set with the heads of all common ancestors of all nodes, |
21 """Returns a set with the heads of all common ancestors of all nodes, |
19 heads(::nodes[0] and ::nodes[1] and ...) . |
22 heads(::nodes[0] and ::nodes[1] and ...) . |
20 |
23 |
377 except StopIteration: |
380 except StopIteration: |
378 # Set to None to indicate fast-path can be used next time, and to |
381 # Set to None to indicate fast-path can be used next time, and to |
379 # free up memory. |
382 # free up memory. |
380 self._containsiter = None |
383 self._containsiter = None |
381 return False |
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) |