diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py --- a/mercurial/filemerge.py +++ b/mercurial/filemerge.py @@ -348,7 +348,9 @@ return 0 if premerge not in validkeep: # restore from backup and try again - util.copyfile(back, repo.wjoin(fcd.path())) + # TODO: Add a workingfilectx.write(otherfilectx) path so we can use + # util.copy here instead. + fcd.write(util.readfile(back), fcd.flags()) return 1 # continue merging def _mergecheck(repo, mynode, orig, fcd, fco, fca, toolconf): @@ -587,7 +589,7 @@ def _makebackup(repo, ui, fcd, premerge): """Makes a backup of the local `fcd` file prior to merging. - + In addition to preserving the user's pre-existing modifications to `fcd` (if any), the backup is used to undo certain premerges, confirm whether a merge changed anything, and determine what line endings the new file should