Patchwork D3606: py3: make sure we open files in bytes mode

login
register
mail settings
Submitter phabricator
Date May 19, 2018, 7:39 p.m.
Message ID <4abcd30dbdc4e9b32a266d412a747bae@localhost.localdomain>
Download mbox | patch
Permalink /patch/31727/
State Not Applicable
Headers show

Comments

phabricator - May 19, 2018, 7:39 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG1978abdb216c: py3: make sure we open files in bytes mode (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3606?vs=8777&id=8810

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

AFFECTED FILES
  hgext/churn.py
  mercurial/crecord.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -554,7 +554,7 @@ 
     """
     chunkselector = curseschunkselector(headerlist, ui, operation)
     if testfn and os.path.exists(testfn):
-        testf = open(testfn)
+        testf = open(testfn, 'rb')
         testcommands = [x.rstrip('\n') for x in testf.readlines()]
         testf.close()
         while True:
diff --git a/hgext/churn.py b/hgext/churn.py
--- a/hgext/churn.py
+++ b/hgext/churn.py
@@ -161,7 +161,7 @@ 
     if not aliases and os.path.exists(repo.wjoin('.hgchurn')):
         aliases = repo.wjoin('.hgchurn')
     if aliases:
-        for l in open(aliases, "r"):
+        for l in open(aliases, "rb"):
             try:
                 alias, actual = l.rsplit('=' in l and '=' or None, 1)
                 amap[alias.strip()] = actual.strip()