Patchwork D2868: util: prefer "bytesio" to "stringio"

login
register
mail settings
Submitter phabricator
Date March 15, 2018, 4:54 p.m.
Message ID <c7ed3cad3f84d9fbbc53d942f3ee2326@localhost.localdomain>
Download mbox | patch
Permalink /patch/29546/
State Not Applicable
Headers show

Comments

phabricator - March 15, 2018, 4:54 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG6619acb2fcbc: util: prefer &quot;bytesio&quot; to &quot;stringio&quot; (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2868?vs=7046&id=7067

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

AFFECTED FILES
  mercurial/pure/mpatch.py
  mercurial/pure/parsers.py
  mercurial/pycompat.py
  mercurial/util.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -71,7 +71,9 @@ 
 stderr = pycompat.stderr
 stdin = pycompat.stdin
 stdout = pycompat.stdout
-stringio = pycompat.stringio
+bytesio = pycompat.bytesio
+# TODO deprecate stringio name, as it is a lie on Python 3.
+stringio = bytesio
 xmlrpclib = pycompat.xmlrpclib
 
 httpserver = urllibcompat.httpserver
diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py
--- a/mercurial/pycompat.py
+++ b/mercurial/pycompat.py
@@ -64,7 +64,9 @@ 
     sysexecutable = sys.executable
     if sysexecutable:
         sysexecutable = os.fsencode(sysexecutable)
-    stringio = io.BytesIO
+    bytesio = io.BytesIO
+    # TODO deprecate stringio name, as it is a lie on Python 3.
+    stringio = bytesio
 
     def maplist(*args):
         return list(map(*args))
@@ -343,7 +345,8 @@ 
     getcwd = os.getcwd
     sysexecutable = sys.executable
     shlexsplit = shlex.split
-    stringio = cStringIO.StringIO
+    bytesio = cStringIO.StringIO
+    stringio = bytesio
     maplist = map
     ziplist = zip
     rawinput = raw_input
diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -12,7 +12,7 @@ 
 
 from ..node import nullid
 from .. import pycompat
-stringio = pycompat.stringio
+stringio = pycompat.bytesio
 
 
 _pack = struct.pack
diff --git a/mercurial/pure/mpatch.py b/mercurial/pure/mpatch.py
--- a/mercurial/pure/mpatch.py
+++ b/mercurial/pure/mpatch.py
@@ -10,7 +10,7 @@ 
 import struct
 
 from .. import pycompat
-stringio = pycompat.stringio
+stringio = pycompat.bytesio
 
 class mpatchError(Exception):
     """error raised when a delta cannot be decoded