##// END OF EJS Templates
ui: use bytes IO and convert EOL manually in ui.editor()...
Yuya Nishihara -
r31778:ac69675f default
parent child Browse files
Show More
@@ -1232,11 +1232,11 b' class ui(object):'
1232 if self.configbool('experimental', 'editortmpinhg'):
1232 if self.configbool('experimental', 'editortmpinhg'):
1233 rdir = repopath
1233 rdir = repopath
1234 (fd, name) = tempfile.mkstemp(prefix='hg-' + extra['prefix'] + '-',
1234 (fd, name) = tempfile.mkstemp(prefix='hg-' + extra['prefix'] + '-',
1235 suffix=extra['suffix'], text=True,
1235 suffix=extra['suffix'],
1236 dir=rdir)
1236 dir=rdir)
1237 try:
1237 try:
1238 f = os.fdopen(fd, pycompat.sysstr("w"))
1238 f = os.fdopen(fd, r'wb')
1239 f.write(encoding.strfromlocal(text))
1239 f.write(util.tonativeeol(text))
1240 f.close()
1240 f.close()
1241
1241
1242 environ = {'HGUSER': user}
1242 environ = {'HGUSER': user}
@@ -1258,8 +1258,8 b' class ui(object):'
1258 onerr=error.Abort, errprefix=_("edit failed"),
1258 onerr=error.Abort, errprefix=_("edit failed"),
1259 blockedtag='editor')
1259 blockedtag='editor')
1260
1260
1261 f = open(name)
1261 f = open(name, r'rb')
1262 t = encoding.strtolocal(f.read())
1262 t = util.fromnativeeol(f.read())
1263 f.close()
1263 f.close()
1264 finally:
1264 finally:
1265 os.unlink(name)
1265 os.unlink(name)
General Comments 0
You need to be logged in to leave comments. Login now