extract: use a single return
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 06 Oct 2015 02:11:09 -0700
changeset 26555 1e33384ff2ed
parent 26554 a6d51dcb1823
child 26556 2bef84fad19f
extract: use a single return The differences between both returns are now very thin, we factor out that part.
mercurial/patch.py
--- 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):