py3: open files in bytes mode in transplant.py
Differential Revision: https://phab.mercurial-scm.org/D2265
--- a/hgext/transplant.py Wed Feb 14 17:06:20 2018 +0530
+++ b/hgext/transplant.py Wed Feb 14 17:39:56 2018 +0530
@@ -211,7 +211,7 @@
patchfile = None
else:
fd, patchfile = tempfile.mkstemp(prefix='hg-transplant-')
- fp = os.fdopen(fd, pycompat.sysstr('w'))
+ fp = os.fdopen(fd, pycompat.sysstr('wb'))
gen = patch.diff(source, parent, node, opts=diffopts)
for chunk in gen:
fp.write(chunk)
@@ -259,7 +259,7 @@
self.ui.status(_('filtering %s\n') % patchfile)
user, date, msg = (changelog[1], changelog[2], changelog[4])
fd, headerfile = tempfile.mkstemp(prefix='hg-transplant-')
- fp = os.fdopen(fd, pycompat.sysstr('w'))
+ fp = os.fdopen(fd, pycompat.sysstr('wb'))
fp.write("# HG changeset patch\n")
fp.write("# User %s\n" % user)
fp.write("# Date %d %d\n" % date)