[PATCH V2] configitems: register the 'win32mbcs.encoding' config
Boris Feld
boris.feld at octobus.net
Wed Sep 13 10:30:54 UTC 2017
# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1498787154 -7200
# ven. juin 30 03:45:54 2017 +0200
# Node ID 5fb90f89802ce9428913ef67df6a96d66e218d51
# Parent a763c891f36e55f4869f443c220227d1da747d18
# EXP-Topic config.register.win32mbcs
configitems: register the 'win32mbcs.encoding' config
diff -r a763c891f36e -r 5fb90f89802c hgext/win32mbcs.py
--- a/hgext/win32mbcs.py mar. sept. 05 15:18:45 2017 -0700
+++ b/hgext/win32mbcs.py ven. juin 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():
More information about the Mercurial-devel
mailing list