filemerge: don't try to copy files known to be absent
authorSiddharth Agarwal <sid0@fb.com>
Sat, 14 Nov 2015 00:00:46 -0800
changeset 27047 e1458049dca5
parent 27046 37fcfe52c68c
child 27048 86290f6f6599
filemerge: don't try to copy files known to be absent We set 'back' to None in this case, so we need to handle that as well.
mercurial/filemerge.py
--- a/mercurial/filemerge.py	Sat Oct 31 22:07:40 2015 +0900
+++ b/mercurial/filemerge.py	Sat Nov 14 00:00:46 2015 -0800
@@ -600,9 +600,12 @@
     a = repo.wjoin(fd)
     b = temp("base", fca)
     c = temp("other", fco)
-    back = cmdutil.origpath(ui, repo, a)
-    if premerge:
-        util.copyfile(a, back)
+    if not fcd.isabsent():
+        back = cmdutil.origpath(ui, repo, a)
+        if premerge:
+            util.copyfile(a, back)
+    else:
+        back = None
     files = (a, b, c, back)
 
     r = 1
@@ -630,7 +633,7 @@
 
         return True, r, deleted
     finally:
-        if not r:
+        if not r and back is not None:
             util.unlink(back)
         util.unlink(b)
         util.unlink(c)
@@ -655,13 +658,13 @@
     if not r and not checked and (_toolbool(ui, tool, "checkchanged") or
                                   'changed' in
                                   _toollist(ui, tool, "check")):
-        if filecmp.cmp(a, back):
+        if back is not None and filecmp.cmp(a, back):
             if ui.promptchoice(_(" output file %s appears unchanged\n"
                                  "was merge successful (yn)?"
                                  "$$ &Yes $$ &No") % fd, 1):
                 r = 1
 
-    if _toolbool(ui, tool, "fixeol"):
+    if back is not None and _toolbool(ui, tool, "fixeol"):
         _matcheol(a, back)
 
     return r