merge: fix quadratic behavior in find-copies
authorMatt Mackall <mpm@selenic.com>
Mon, 16 Apr 2007 12:24:52 -0500
changeset 4350 8aee687f0214
parent 4348 b633f470944e
child 4354 c3c53eb44611
merge: fix quadratic behavior in find-copies
mercurial/merge.py
--- a/mercurial/merge.py	Mon Apr 16 09:51:50 2007 -0500
+++ b/mercurial/merge.py	Mon Apr 16 12:24:52 2007 -0500
@@ -105,10 +105,15 @@
     def findold(fctx):
         "find files that path was copied from, back to linkrev limit"
         old = {}
+        seen = {}
         orig = fctx.path()
         visit = [fctx]
         while visit:
             fc = visit.pop()
+            s = str(fc)
+            if s in seen:
+                continue
+            seen[s] = 1
             if fc.path() != orig and fc.path() not in old:
                 old[fc.path()] = 1
             if fc.rev() < limit: