Mercurial > hg
diff hgext/win32mbcs.py @ 34180:37513324f620
configitems: register the 'win32mbcs.encoding' config
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Fri, 30 Jun 2017 03:45:54 +0200 |
parents | 9929af2b09b4 |
children | 75979c8d4572 |
line wrap: on
line diff
--- a/hgext/win32mbcs.py Sun Sep 03 03:49:15 2017 +0530 +++ b/hgext/win32mbcs.py Fri Jun 30 03:45:54 2017 +0200 @@ -54,6 +54,7 @@ encoding, error, pycompat, + registrar, ) # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for @@ -62,6 +63,15 @@ # 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 @@ 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():