filemerge: eliminate most uses of tempfiles
authorPhil Cohen <phillco@fb.com>
Thu, 31 Aug 2017 11:28:59 -0700
changeset 34049 67cfffbfb6a0
parent 34048 52bd006b4f49
child 34050 d37f1bb68169
filemerge: eliminate most uses of tempfiles Emphasize that they're unused so we can more easily remove them later. Differential Revision: https://phab.mercurial-scm.org/D399
mercurial/filemerge.py
--- a/mercurial/filemerge.py	Thu Aug 31 11:05:19 2017 -0700
+++ b/mercurial/filemerge.py	Thu Aug 31 11:28:59 2017 -0700
@@ -318,7 +318,7 @@
     tool, toolpath, binary, symlink = toolconf
     if symlink or fcd.isabsent() or fco.isabsent():
         return 1
-    a, b, c, back = files
+    unused, unused, unused, back = files
 
     ui = repo.ui
 
@@ -347,7 +347,8 @@
             ui.debug(" premerge successful\n")
             return 0
         if premerge not in validkeep:
-            util.copyfile(back, a) # restore from backup and try again
+            # restore from backup and try again
+            util.copyfile(back, repo.wjoin(fcd.path()))
     return 1 # continue merging
 
 def _mergecheck(repo, mynode, orig, fcd, fco, fca, toolconf):
@@ -368,8 +369,6 @@
     files. It will fail if there are any conflicts and leave markers in
     the partially merged file. Markers will have two sections, one for each side
     of merge, unless mode equals 'union' which suppresses the markers."""
-    a, b, c, back = files
-
     ui = repo.ui
 
     r = simplemerge.simplemerge(ui, fcd, fca, fco,
@@ -424,7 +423,6 @@
     """
     assert localorother is not None
     tool, toolpath, binary, symlink = toolconf
-    a, b, c, back = files
     r = simplemerge.simplemerge(repo.ui, fcd, fca, fco,
                                 label=labels, localorother=localorother,
                                 repo=repo)
@@ -470,7 +468,7 @@
     This implies permerge. Therefore, files aren't dumped, if premerge
     runs successfully. Use :forcedump to forcibly write files out.
     """
-    a, b, c, back = files
+    a, unused, unused, unused = files
 
     fd = fcd.path()
 
@@ -720,7 +718,7 @@
 
 def _check(r, ui, tool, fcd, files):
     fd = fcd.path()
-    a, b, c, back = files
+    a, unused, unused, back = files
 
     if not r and (_toolbool(ui, tool, "checkconflicts") or
                   'conflicts' in _toollist(ui, tool, "check")):