merge: pull file copy/move out of filemerge
authorMatt Mackall <mpm@selenic.com>
Tue, 10 Oct 2006 00:54:00 -0500
changeset 3309 e8be5942335d
parent 3308 ecc1bf27378c
child 3310 0e370798eebf
merge: pull file copy/move out of filemerge
mercurial/merge.py
--- a/mercurial/merge.py	Tue Oct 10 00:41:55 2006 -0500
+++ b/mercurial/merge.py	Tue Oct 10 00:54:00 2006 -0500
@@ -10,14 +10,12 @@
 from demandload import *
 demandload(globals(), "errno util os tempfile")
 
-def filemerge(repo, fw, fo, fd, wctx, mctx, move):
+def filemerge(repo, fw, fo, wctx, mctx):
     """perform a 3-way merge in the working directory
 
     fw = filename in the working directory and first parent
     fo = filename in other parent
-    fd = destination filename
     wctx, mctx = working and merge changecontexts
-    move = whether to move or copy the file to the destination
 
     TODO:
       if fw is copied in the working directory, we get confused
@@ -52,13 +50,6 @@
                              'HG_OTHER_NODE': str(mctx)})
     if r:
         repo.ui.warn(_("merging %s failed!\n") % fw)
-    else:
-        if fd != fw:
-            repo.ui.debug(_("copying %s to %s\n") % (fw, fd))
-            repo.wwrite(fd, repo.wread(fw))
-            if move:
-                repo.ui.debug(_("removing %s\n") % fw)
-                os.unlink(a)
 
     os.unlink(b)
     os.unlink(c)
@@ -294,8 +285,16 @@
                 repo.ui.status(_("merging %s and %s to %s\n") % (f, f2, fd))
             else:
                 repo.ui.status(_("merging %s\n") % f)
-            if filemerge(repo, f, f2, fd, wctx, mctx, move):
+            if filemerge(repo, f, f2, wctx, mctx):
                 unresolved += 1
+            else:
+                if f != fd:
+                    repo.ui.debug(_("copying %s to %s\n") % (f, fd))
+                    repo.wwrite(fd, repo.wread(f))
+                    if move:
+                        repo.ui.debug(_("removing %s\n") % f)
+                        os.unlink(repo.wjoin(f))
+
             util.set_exec(repo.wjoin(fd), flag)
             merged += 1
         elif m == "g": # get