Patchwork D2265: py3: open files in bytes mode in transplant.py

login
register
mail settings
Submitter phabricator
Date Feb. 14, 2018, 1:42 p.m.
Message ID <ceef3cd6b9c5aafad799a049d3b666a4@localhost.localdomain>
Download mbox | patch
Permalink /patch/27918/
State Not Applicable
Headers show

Comments

phabricator - Feb. 14, 2018, 1:42 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGa9d1ac7b91a8: py3: open files in bytes mode in transplant.py (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2265?vs=5705&id=5719

REVISION DETAIL
  https://phab.mercurial-scm.org/D2265

AFFECTED FILES
  hgext/transplant.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/hgext/transplant.py b/hgext/transplant.py
--- a/hgext/transplant.py
+++ b/hgext/transplant.py
@@ -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)