[PATCH 08 of 12 py3] encoding: make encoding.encoding be a native str and add encodingb
Augie Fackler
raf at durin42.com
Sun Mar 12 15:49:57 EDT 2017
# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1489303712 14400
# Sun Mar 12 03:28:32 2017 -0400
# Node ID 19f6f41baa5ef326d3cc953093c5d7ff5dcc4427
# Parent 84996257b560fa41535e4d0360cb33436662581c
encoding: make encoding.encoding be a native str and add encodingb
It turns out we need the encoding name both ways. Ugh.
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -965,7 +965,7 @@ def debuginstall(ui, **opts):
fm.startitem()
# encoding
- fm.write('encoding', _("checking encoding (%s)...\n"), encoding.encoding)
+ fm.write('encoding', _("checking encoding (%s)...\n"), encoding.encodingb)
err = None
try:
encoding.fromlocal("test")
diff --git a/mercurial/encoding.py b/mercurial/encoding.py
--- a/mercurial/encoding.py
+++ b/mercurial/encoding.py
@@ -100,6 +100,11 @@ except locale.Error:
encodingmode = environ.get("HGENCODINGMODE", "strict")
fallbackencoding = 'ISO-8859-1'
+encodingb = encoding
+if pycompat.ispy3:
+ # TODO: are all encodings sure to be ascii names?
+ encoding = encoding.decode('ascii')
+
class localstr(str):
'''This class allows strings that are unmodified to be
round-tripped to the local encoding and back'''
diff --git a/tests/test-check-code.t b/tests/test-check-code.t
--- a/tests/test-check-code.t
+++ b/tests/test-check-code.t
@@ -22,7 +22,7 @@ New errors are not allowed. Warnings are
mercurial/encoding.py:61:
> for k, v in os.environ.items())
use encoding.environ instead (py3)
- mercurial/encoding.py:203:
+ mercurial/encoding.py:208:
> for k, v in os.environ.items())
use encoding.environ instead (py3)
Skipping mercurial/httpclient/__init__.py it has no-che?k-code (glob)
More information about the Mercurial-devel
mailing list