[PATCH 6 of 7 V2 mergedriver] filemerge: only copy to backup during premerge step

Siddharth Agarwal sid0 at fb.com
Mon Oct 12 02:45:41 CDT 2015


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1444619080 25200
#      Sun Oct 11 20:04:40 2015 -0700
# Node ID 82558c58ceeeae364c1d65413c8860d48c7d3e97
# Parent  4d0ba4be4eb10d20e4f7c97049cb3bb093222a5e
filemerge: only copy to backup during premerge step

The premerge might leave the original file in an unclean state. Therefore it's
important to only copy the file in the beginning.

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -505,7 +505,8 @@ def _filemerge(premerge, repo, mynode, o
     b = temp("base", fca)
     c = temp("other", fco)
     back = a + ".orig"
-    util.copyfile(a, back)
+    if premerge:
+        util.copyfile(a, back)
     files = (a, b, c, back)
 
     r = 1


More information about the Mercurial-devel mailing list