##// END OF EJS Templates
ancestors: prefetch method outside of the loop...
Pierre-Yves David -
r25639:7125225a default
parent child Browse files
Show More
@@ -316,11 +316,14 b' class lazyancestors(object):'
316 316 stoprev = self._stoprev
317 317 visit = collections.deque(revs)
318 318
319 see = seen.add
320 schedule = visit.append
321
319 322 while visit:
320 323 for parent in parentrevs(visit.popleft()):
321 324 if parent >= stoprev and parent not in seen:
322 visit.append(parent)
323 seen.add(parent)
325 schedule(parent)
326 see(parent)
324 327 yield parent
325 328
326 329 def __contains__(self, target):
@@ -337,6 +340,7 b' class lazyancestors(object):'
337 340 stoprev = self._stoprev
338 341 heappop = heapq.heappop
339 342 heappush = heapq.heappush
343 see = seen.add
340 344
341 345 targetseen = False
342 346
@@ -347,7 +351,7 b' class lazyancestors(object):'
347 351 # We need to make sure we push all parents into the heap so
348 352 # that we leave it in a consistent state for future calls.
349 353 heappush(visit, -parent)
350 seen.add(parent)
354 see(parent)
351 355 if parent == target:
352 356 targetseen = True
353 357
General Comments 0
You need to be logged in to leave comments. Login now