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

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Wed Feb 14 08:42:56 EST 2018


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

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)



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


More information about the Mercurial-devel mailing list