Patchwork D2501: py3: make sure we write in mergestate in bytes mode

login
register
mail settings
Submitter phabricator
Date Feb. 28, 2018, 10:29 p.m.
Message ID <differential-rev-PHID-DREV-ppgplrrgwtsyovue5ch5-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/28501/
State Superseded
Headers show

Comments

phabricator - Feb. 28, 2018, 10:29 p.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/merge.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel
phabricator - March 1, 2018, 9:39 a.m.
yuja added a comment.


  This is actually noop since vfs adds 'b' automatically, but an explicit 'b' looks better.

REPOSITORY
  rHG Mercurial

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

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

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -399,7 +399,7 @@ 
 
     def _writerecordsv1(self, records):
         """Write current state on disk in a version 1 file"""
-        f = self._repo.vfs(self.statepathv1, 'w')
+        f = self._repo.vfs(self.statepathv1, 'wb')
         irecords = iter(records)
         lrecords = next(irecords)
         assert lrecords[0] == 'L'
@@ -415,7 +415,7 @@ 
         See the docstring for _readrecordsv2 for why we use 't'."""
         # these are the records that all version 2 clients can read
         whitelist = 'LOF'
-        f = self._repo.vfs(self.statepathv2, 'w')
+        f = self._repo.vfs(self.statepathv2, 'wb')
         for key, data in records:
             assert len(key) == 1
             if key not in whitelist: