extract: use a single return
The differences between both returns are now very thin, we factor out
that part.
--- a/mercurial/patch.py Wed Oct 07 00:50:53 2015 -0700
+++ b/mercurial/patch.py Tue Oct 06 02:11:09 2015 -0700
@@ -262,16 +262,15 @@
data['message'] = message
data['user'] = user
tmpfp.close()
- if not diffs_seen:
- os.unlink(tmpname)
- return data
-
if parents:
data['p1'] = parents.pop(0)
if parents:
data['p2'] = parents.pop(0)
- data['filename'] = tmpname
+ if diffs_seen:
+ data['filename'] = tmpname
+ else:
+ os.unlink(tmpname)
return data
class patchmeta(object):