Skip to content
Snippets Groups Projects
Commit e6508d1e authored by Matt Harbison's avatar Matt Harbison
Browse files

win32mbcs: use str for encoding value

This was reported to the TortoiseHg tracker as:
mercurial/tortoisehg/thg#5980

It doesn't look like we have any tests for this extension, but the explicit
type hints are enough to convince pytype that the module level `_encoding` attr
is str.  The `encode()` and `decode()` methods are too complex to add type hints
for them.
parent 45ba8416
No related branches found
No related tags found
2 merge requests!909branching: merge stable into default post 6.8.1,!885win32mbcs: use str for encoding value
......@@ -73,7 +73,7 @@
default=lambda: encoding.encoding,
)
_encoding = None # see extsetup
_encoding: str = "" # see extsetup
def decode(arg):
......@@ -129,7 +129,7 @@
except UnicodeError:
raise error.Abort(
_(b"[win32mbcs] filename conversion failed with %s encoding\n")
% _encoding
% encoding.strtolocal(_encoding)
)
......@@ -199,7 +199,7 @@
return
# determine encoding for filename
global _encoding
_encoding = ui.config(b'win32mbcs', b'encoding')
_encoding = encoding.strfromlocal(ui.config(b'win32mbcs', b'encoding'))
# fake is only for relevant environment.
if _encoding.lower() in problematic_encodings.split():
for f in funcs.split():
......@@ -217,5 +217,6 @@
# extensions.loadall() is called.
if '--debug' in sys.argv:
ui.writenoi18n(
b"[win32mbcs] activated with encoding: %s\n" % _encoding
b"[win32mbcs] activated with encoding: %s\n"
% encoding.strtolocal(_encoding)
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment