# HG changeset patch # User Siddharth Agarwal # Date 1444279884 25200 # Node ID fb388aa26453080a703a22df8b199689295114ba # Parent b3f7516fa50ef4bd6080bc7a7ce715373933872a filemerge: clean up temp files in a finally block This isn't really a big deal because the temp files are created in $TMPDIR, but it makes some upcoming work simpler. diff -r b3f7516fa50e -r fb388aa26453 mercurial/filemerge.py --- a/mercurial/filemerge.py Thu Oct 08 12:53:09 2015 -0700 +++ b/mercurial/filemerge.py Wed Oct 07 21:51:24 2015 -0700 @@ -505,13 +505,14 @@ util.copyfile(a, back) files = (a, b, c, back) + r = 1 + try: markerstyle = ui.config('ui', 'mergemarkers', 'basic') if not labels: labels = _defaultconflictlabels if markerstyle != 'basic': labels = _formatlabels(repo, fcd, fco, fca, labels) - r = 1 if mergetype == fullmerge: r = _premerge(repo, toolconf, files, labels=labels) @@ -527,12 +528,13 @@ if r: if onfailure: ui.warn(onfailure % fd) - else: + + return r + finally: + if not r: util.unlink(back) - util.unlink(b) util.unlink(c) - return r def _check(r, ui, tool, fcd, files): fd = fcd.path()