changeset 34036:fe04c018eaac

filemerge: add _restorebackup Differential Revision: https://phab.mercurial-scm.org/D404
author Phil Cohen <phillco@fb.com>
date Thu, 31 Aug 2017 11:28:59 -0700
parents 96123bdea43e
children 65ae54582713
files mercurial/filemerge.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/filemerge.py	Thu Aug 31 11:28:59 2017 -0700
+++ b/mercurial/filemerge.py	Thu Aug 31 11:28:59 2017 -0700
@@ -348,9 +348,7 @@
             return 0
         if premerge not in validkeep:
             # restore from backup and try again
-            # TODO: Add a workingfilectx.write(otherfilectx) path so we can use
-            # util.copy here instead.
-            fcd.write(util.readfile(back), fcd.flags())
+            _restorebackup(fcd, back)
     return 1 # continue merging
 
 def _mergecheck(repo, mynode, orig, fcd, fco, fca, toolconf):
@@ -590,6 +588,11 @@
         "o": " [%s]" % labels[1],
     }
 
+def _restorebackup(fcd, back):
+    # TODO: Add a workingfilectx.write(otherfilectx) path so we can use
+    # util.copy here instead.
+    fcd.write(util.readfile(back), fcd.flags())
+
 def _makebackup(repo, ui, fcd, premerge):
     """Makes a backup of the local `fcd` file prior to merging.