[PATCH 1 of 6] filemerge: clean up temp files in a finally block
Siddharth Agarwal
sid0 at fb.com
Fri Oct 9 18:46:08 UTC 2015
# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1444279884 25200
# Wed Oct 07 21:51:24 2015 -0700
# Node ID f32ecec8697102c6daeda1f3a98711a8305f928d
# Parent c22f7a4cc983588c6759f869d5c94f667bad1f70
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 --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -505,13 +505,14 @@ def filemerge(repo, mynode, orig, fcd, f
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 @@ def filemerge(repo, mynode, orig, fcd, f
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()
More information about the Mercurial-devel
mailing list