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

login
register
mail settings
Submitter Siddharth Agarwal
Date Oct. 12, 2015, 7:45 a.m.
Message ID <82558c58ceeeae364c1d.1444635941@dev6666.prn1.facebook.com>
Download mbox | patch
Permalink /patch/10955/
State Accepted
Headers show

Comments

Siddharth Agarwal - Oct. 12, 2015, 7:45 a.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@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.

Patch

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