mercurial/ancestor.py
changeset 7882 8d78fc991b71
parent 6429 532ca442b903
child 8225 46293a0c7e9f
--- a/mercurial/ancestor.py	Mon Mar 23 13:49:16 2009 +0100
+++ b/mercurial/ancestor.py	Mon Mar 23 15:36:30 2009 +0100
@@ -19,11 +19,13 @@
         return a
 
     # find depth from root of all ancestors
+    parentcache = {}
     visit = [a, b]
     depth = {}
     while visit:
         vertex = visit[-1]
         pl = pfunc(vertex)
+        parentcache[vertex] = pl
         if not pl:
             depth[vertex] = 0
             visit.pop()
@@ -46,7 +48,7 @@
             if n not in seen:
                 seen[n] = 1
                 yield (d, n)
-                for p in pfunc(n):
+                for p in parentcache[n]:
                     heapq.heappush(h, (depth[p], p))
 
     def generations(vertex):