[PATCH 08 of 12 py3] encoding: make encoding.encoding be a native str and add encodingb
Yuya Nishihara
yuya at tcha.org
Sun Mar 12 16:11:18 EDT 2017
On Sun, 12 Mar 2017 15:49:57 -0400, Augie Fackler wrote:
> # 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')
Unfortunately encoding.encoding isn't readonly. dispatch, hgweb and convert
overwrite it.
Maybe we can add unicode variants of encoding.from/tolocal() instead?
More information about the Mercurial-devel
mailing list