##// END OF EJS Templates
ancestor: unroll loop of parents in _lazyancestorsiter()...
Yuya Nishihara -
r39571:b9ee9c2e default
parent child Browse files
Show More
@@ -274,20 +274,26 b' def _lazyancestorsiter(parentrevs, initr'
274 visit = []
274 visit = []
275 heapq.heapify(visit)
275 heapq.heapify(visit)
276 for r in initrevs:
276 for r in initrevs:
277 for parent in parentrevs(r):
277 p1, p2 = parentrevs(r)
278 if parent not in seen:
278 if p1 not in seen:
279 schedule(visit, -parent)
279 schedule(visit, -p1)
280 see(parent)
280 see(p1)
281 if p2 not in seen:
282 schedule(visit, -p2)
283 see(p2)
281
284
282 while visit:
285 while visit:
283 current = -nextitem(visit)
286 current = -nextitem(visit)
284 if current < stoprev:
287 if current < stoprev:
285 break
288 break
286 yield current
289 yield current
287 for parent in parentrevs(current):
290 p1, p2 = parentrevs(current)
288 if parent not in seen:
291 if p1 not in seen:
289 schedule(visit, -parent)
292 schedule(visit, -p1)
290 see(parent)
293 see(p1)
294 if p2 not in seen:
295 schedule(visit, -p2)
296 see(p2)
291
297
292 class lazyancestors(object):
298 class lazyancestors(object):
293 def __init__(self, pfunc, revs, stoprev=0, inclusive=False):
299 def __init__(self, pfunc, revs, stoprev=0, inclusive=False):
@@ -178,9 +178,9 b' def test_missingancestors(seed, rng):'
178 # |
178 # |
179 # o 0
179 # o 0
180
180
181 graph = {0: [-1], 1: [0], 2: [1], 3: [1], 4: [2], 5: [4], 6: [4],
181 graph = {0: [-1, -1], 1: [0, -1], 2: [1, -1], 3: [1, -1], 4: [2, -1],
182 7: [4], 8: [-1], 9: [6, 7], 10: [5], 11: [3, 7], 12: [9],
182 5: [4, -1], 6: [4, -1], 7: [4, -1], 8: [-1, -1], 9: [6, 7],
183 13: [8]}
183 10: [5, -1], 11: [3, 7], 12: [9, -1], 13: [8, -1]}
184
184
185 def genlazyancestors(revs, stoprev=0, inclusive=False):
185 def genlazyancestors(revs, stoprev=0, inclusive=False):
186 print(("%% lazy ancestor set for %s, stoprev = %s, inclusive = %s" %
186 print(("%% lazy ancestor set for %s, stoprev = %s, inclusive = %s" %
General Comments 0
You need to be logged in to leave comments. Login now