changeset 26555:1e33384ff2ed

extract: use a single return The differences between both returns are now very thin, we factor out that part.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 06 Oct 2015 02:11:09 -0700
parents a6d51dcb1823
children 2bef84fad19f
files mercurial/patch.py
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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):