mercurial/ancestor.py
changeset 39533 f6bcb4f9cd3c
parent 39482 77a2f6d805f2
child 39534 fd9029d36c41
equal deleted inserted replaced
39532:55eea29833d2 39533:f6bcb4f9cd3c
   260         return missing
   260         return missing
   261 
   261 
   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     revs = initrevs
       
   266 
       
   267     schedule = heapq.heappush
   265     schedule = heapq.heappush
   268     nextitem = heapq.heappop
   266     nextitem = heapq.heappop
   269     see = seen.add
   267     see = seen.add
   270 
   268 
   271     if inclusive:
   269     if inclusive:
   272         visit = [-r for r in revs]
   270         visit = [-r for r in initrevs]
   273         seen.update(revs)
   271         seen.update(initrevs)
   274         heapq.heapify(visit)
   272         heapq.heapify(visit)
   275     else:
   273     else:
   276         visit = []
   274         visit = []
   277         heapq.heapify(visit)
   275         heapq.heapify(visit)
   278         for r in revs:
   276         for r in initrevs:
   279             for parent in parentrevs(r):
   277             for parent in parentrevs(r):
   280                 if parent not in seen:
   278                 if parent not in seen:
   281                     schedule(visit, -parent)
   279                     schedule(visit, -parent)
   282                     see(parent)
   280                     see(parent)
   283 
   281