mercurial/filemerge.py
changeset 30547 c2154979409d
parent 30469 ce3a133f71b3
child 30641 f1c9fafcbf46
--- a/mercurial/filemerge.py	Sat Nov 26 09:14:41 2016 -0800
+++ b/mercurial/filemerge.py	Wed Nov 23 23:47:38 2016 +0100
@@ -577,8 +577,9 @@
     a boolean indicating whether the file was deleted from disk."""
 
     def temp(prefix, ctx):
-        pre = "%s~%s." % (os.path.basename(ctx.path()), prefix)
-        (fd, name) = tempfile.mkstemp(prefix=pre)
+        fullbase, ext = os.path.splitext(ctx.path())
+        pre = "%s~%s." % (os.path.basename(fullbase), prefix)
+        (fd, name) = tempfile.mkstemp(prefix=pre, suffix=ext)
         data = repo.wwritedata(ctx.path(), ctx.data())
         f = os.fdopen(fd, "wb")
         f.write(data)