From patchwork Thu Aug 31 18:30:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D404: filemerge: add _restorebackup From: phabricator X-Patchwork-Id: 23559 Message-Id: <9ccc61f287828debbdf7216574f8509d@localhost.localdomain> To: mercurial-devel@mercurial-scm.org Date: Thu, 31 Aug 2017 18:30:18 +0000 phillco updated this revision to Diff 1490. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D404?vs=1483&id=1490 REVISION DETAIL https://phab.mercurial-scm.org/D404 AFFECTED FILES mercurial/filemerge.py CHANGE DETAILS To: phillco, #hg-reviewers Cc: mercurial-devel diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py --- a/mercurial/filemerge.py +++ b/mercurial/filemerge.py @@ -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): @@ -591,6 +589,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.