mercurial/merge.py
changeset 4417 0912d8df5e19
parent 4410 bbc97d419b16
parent 4416 bb1800a7d7e1
child 4623 66ed92ed115a
--- a/mercurial/merge.py	Sat May 05 15:56:49 2007 +0900
+++ b/mercurial/merge.py	Tue May 08 11:42:48 2007 -0500
@@ -7,7 +7,7 @@
 
 from node import *
 from i18n import _
-import errno, util, os, tempfile
+import errno, util, os, tempfile, context
 
 def filemerge(repo, fw, fo, wctx, mctx):
     """perform a 3-way merge in the working directory
@@ -123,6 +123,14 @@
                 f = dirname(f)
         return d
 
+    wctx = repo.workingctx()
+
+    def makectx(f, n):
+        if len(n) == 20:
+            return repo.filectx(f, fileid=n)
+        return wctx.filectx(f)
+    ctx = util.cachefunc(makectx)
+
     def findold(fctx):
         "find files that path was copied from, back to linkrev limit"
         old = {}
@@ -160,7 +168,7 @@
             # named changed on only one side?
             if ca.path() == c.path() or ca.path() == c2.path():
                 fullcopy[c.path()] = of # remember for dir rename detection
-                if c == c2: # no merge needed, ignore copy
+                if c == ca or c2 == ca: # no merge needed, ignore copy
                     continue
                 copy[c.path()] = of
 
@@ -171,13 +179,11 @@
     if not m1 or not m2 or not ma:
         return {}
 
-    dcopies = repo.dirstate.copies()
     u1 = nonoverlap(m1, m2, ma)
     u2 = nonoverlap(m2, m1, ma)
-    ctx = util.cachefunc(lambda f, n: repo.filectx(f, fileid=n[:20]))
 
     for f in u1:
-        checkcopies(ctx(dcopies.get(f, f), m1[f]), m2)
+        checkcopies(ctx(f, m1[f]), m2)
 
     for f in u2:
         checkcopies(ctx(f, m2[f]), m1)