changeset 36187:a9d1ac7b91a8

py3: open files in bytes mode in transplant.py Differential Revision: https://phab.mercurial-scm.org/D2265
author Pulkit Goyal <7895pulkit@gmail.com>
date Wed, 14 Feb 2018 17:39:56 +0530
parents c1628a5eac87
children 4e33aa8639d0
files hgext/transplant.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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)