##// END OF EJS Templates
ancestor: rename local aliases of heapq functions in _lazyancestorsiter()...
Yuya Nishihara -
r39573:ca9983c3 default
parent child Browse files
Show More
@@ -262,8 +262,8 b' class incrementalmissingancestors(object'
262 # Extracted from lazyancestors.__iter__ to avoid a reference cycle
262 # Extracted from lazyancestors.__iter__ to avoid a reference cycle
263 def _lazyancestorsiter(parentrevs, initrevs, stoprev, inclusive):
263 def _lazyancestorsiter(parentrevs, initrevs, stoprev, inclusive):
264 seen = {nullrev}
264 seen = {nullrev}
265 schedule = heapq.heappush
265 heappush = heapq.heappush
266 nextitem = heapq.heappop
266 heappop = heapq.heappop
267 see = seen.add
267 see = seen.add
268
268
269 if inclusive:
269 if inclusive:
@@ -276,10 +276,10 b' def _lazyancestorsiter(parentrevs, initr'
276 for r in initrevs:
276 for r in initrevs:
277 p1, p2 = parentrevs(r)
277 p1, p2 = parentrevs(r)
278 if p1 not in seen:
278 if p1 not in seen:
279 schedule(visit, -p1)
279 heappush(visit, -p1)
280 see(p1)
280 see(p1)
281 if p2 not in seen:
281 if p2 not in seen:
282 schedule(visit, -p2)
282 heappush(visit, -p2)
283 see(p2)
283 see(p2)
284
284
285 while visit:
285 while visit:
@@ -294,13 +294,13 b' def _lazyancestorsiter(parentrevs, initr'
294 if current - p1 == 1:
294 if current - p1 == 1:
295 visit[0] = -p1
295 visit[0] = -p1
296 else:
296 else:
297 nextitem(visit)
297 heappop(visit)
298 schedule(visit, -p1)
298 heappush(visit, -p1)
299 see(p1)
299 see(p1)
300 else:
300 else:
301 nextitem(visit)
301 heappop(visit)
302 if p2 not in seen:
302 if p2 not in seen:
303 schedule(visit, -p2)
303 heappush(visit, -p2)
304 see(p2)
304 see(p2)
305
305
306 class lazyancestors(object):
306 class lazyancestors(object):
General Comments 0
You need to be logged in to leave comments. Login now