mercurial/revlog.py
changeset 381 024ee0f8722a
parent 377 e5d769afd3ef
child 451 c9d134165392
equal deleted inserted replaced
380:c72ccad3e3b8 381:024ee0f8722a
   323             h = [(-dist[node], node)]
   323             h = [(-dist[node], node)]
   324             seen = {}
   324             seen = {}
   325             earliest = self.count()
   325             earliest = self.count()
   326             while h:
   326             while h:
   327                 d, n = heapq.heappop(h)
   327                 d, n = heapq.heappop(h)
   328                 r = self.rev(n)
       
   329                 if n not in seen:
   328                 if n not in seen:
   330                     seen[n] = 1
   329                     seen[n] = 1
   331                     yield (-d, n)
   330                     r = self.rev(n)
       
   331                     yield (-d, r, n)
   332                     for p in self.parents(n):
   332                     for p in self.parents(n):
   333                         heapq.heappush(h, (-dist[p], p))
   333                         heapq.heappush(h, (-dist[p], p))
   334 
   334 
   335         x = ancestors(a)
   335         x = ancestors(a)
   336         y = ancestors(b)
   336         y = ancestors(b)
   339 
   339 
   340         # increment each ancestor list until it is closer to root than
   340         # increment each ancestor list until it is closer to root than
   341         # the other, or they match
   341         # the other, or they match
   342         while 1:
   342         while 1:
   343             if lx == ly:
   343             if lx == ly:
   344                 return lx[1]
   344                 return lx[2]
   345             elif lx < ly:
   345             elif lx < ly:
   346                 ly = y.next()
   346                 ly = y.next()
   347             elif lx > ly:
   347             elif lx > ly:
   348                 lx = x.next()
   348                 lx = x.next()
   349 
   349