comparison mercurial/filemerge.py @ 30547:c2154979409d

merge: use original file extension for temporary files Some merge tools (like Araxis?) can pick merge mode based on the file extension. That didn't work well when temporary files were given random suffixes. It seems to work better when the random part is before the extension. As usual, when using $output, $local will have the .orig extension. That could perhaps be the subject of another change another day.
author Mads Kiilerich <madski@unity3d.com>
date Wed, 23 Nov 2016 23:47:38 +0100
parents ce3a133f71b3
children f1c9fafcbf46
comparison
equal deleted inserted replaced
30546:4b0e6677eed1 30547:c2154979409d
575 575
576 Returns whether the merge is complete, the return value of the merge, and 576 Returns whether the merge is complete, the return value of the merge, and
577 a boolean indicating whether the file was deleted from disk.""" 577 a boolean indicating whether the file was deleted from disk."""
578 578
579 def temp(prefix, ctx): 579 def temp(prefix, ctx):
580 pre = "%s~%s." % (os.path.basename(ctx.path()), prefix) 580 fullbase, ext = os.path.splitext(ctx.path())
581 (fd, name) = tempfile.mkstemp(prefix=pre) 581 pre = "%s~%s." % (os.path.basename(fullbase), prefix)
582 (fd, name) = tempfile.mkstemp(prefix=pre, suffix=ext)
582 data = repo.wwritedata(ctx.path(), ctx.data()) 583 data = repo.wwritedata(ctx.path(), ctx.data())
583 f = os.fdopen(fd, "wb") 584 f = os.fdopen(fd, "wb")
584 f.write(data) 585 f.write(data)
585 f.close() 586 f.close()
586 return name 587 return name