comparison mercurial/filemerge.py @ 30924:48dea083f66d

py3: convert the mode argument of os.fdopen to unicodes (1 of 2) os.fdopen() does not accepts bytes as its second argument which represent the mode in which the file is to be opened. This patch makes sure unicodes are passed in py3 by using pycompat.sysstr().
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 13 Feb 2017 20:06:38 +0530
parents 4d019d0e1b3b
children 84e8a6834223
comparison
equal deleted inserted replaced
30923:78de43ab585f 30924:48dea083f66d
583 def temp(prefix, ctx): 583 def temp(prefix, ctx):
584 fullbase, ext = os.path.splitext(ctx.path()) 584 fullbase, ext = os.path.splitext(ctx.path())
585 pre = "%s~%s." % (os.path.basename(fullbase), prefix) 585 pre = "%s~%s." % (os.path.basename(fullbase), prefix)
586 (fd, name) = tempfile.mkstemp(prefix=pre, suffix=ext) 586 (fd, name) = tempfile.mkstemp(prefix=pre, suffix=ext)
587 data = repo.wwritedata(ctx.path(), ctx.data()) 587 data = repo.wwritedata(ctx.path(), ctx.data())
588 f = os.fdopen(fd, "wb") 588 f = os.fdopen(fd, pycompat.sysstr("wb"))
589 f.write(data) 589 f.write(data)
590 f.close() 590 f.close()
591 return name 591 return name
592 592
593 if not fco.cmp(fcd): # files identical? 593 if not fco.cmp(fcd): # files identical?