# HG changeset patch # User Boris Feld # Date 2017-06-30 01:45:54 # Node ID 37513324f620298a6e43768926daa5e2fbec10d9 # Parent 036d47d7cf3926214ea1440a196f953fff8d119f configitems: register the 'win32mbcs.encoding' config diff --git a/hgext/win32mbcs.py b/hgext/win32mbcs.py --- a/hgext/win32mbcs.py +++ b/hgext/win32mbcs.py @@ -54,6 +54,7 @@ from mercurial import ( encoding, error, pycompat, + registrar, ) # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for @@ -62,6 +63,15 @@ from mercurial import ( # leave the attribute unspecified. testedwith = 'ships-with-hg-core' +configtable = {} +configitem = registrar.configitem(configtable) + +# Encoding.encoding may be updated by --encoding option. +# Use a lambda do delay the resolution. +configitem('win32mbcs', 'encoding', + default=lambda: encoding.encoding, +) + _encoding = None # see extsetup def decode(arg): @@ -175,7 +185,7 @@ def extsetup(ui): return # determine encoding for filename global _encoding - _encoding = ui.config('win32mbcs', 'encoding', encoding.encoding) + _encoding = ui.config('win32mbcs', 'encoding') # fake is only for relevant environment. if _encoding.lower() in problematic_encodings.split(): for f in funcs.split():