# Date 1625997753 -32400
# Sun Jul 11 19:02:33 2021 +0900
# Node ID 8cad17c4d34657f1e4943ddfa1f4155c03e89f31
# Parent 98380a5a5bd141d9b2ff276ca269d471037c6ab9
wconfig: drop compatibility layer for hg 5.7
I intentionally leave the wrapper functions with comments as I think they
will give a hint for future refactoring.
diff --git a/tests/wconfig_test.py b/tests/wconfig_test.py
--- a/tests/wconfig_test.py
+++ b/tests/wconfig_test.py
@@ -53,31 +53,23 @@ def writetempfile(s):
os.close(fd)
return path
-if getattr(config.config, 'alter', None):
- # hg >= 5.8 (a3dced4b7b04): config dict is no longer a plain
- # {key: value} dict, but has metadata for each key.
+# Since hg 5.8 (a3dced4b7b04), config dict is no longer a plain
+# {key: value} dict, but has metadata for each key.
- def metadict(src):
- return {k: metavalue(v) for k, v in src.items()}
+def metadict(src):
+ return {k: metavalue(v) for k, v in src.items()}
- def metavalue(v):
- return (v, b'', 0)
-
- def plaindict(src):
- return {k: plainvalue(v) for k, v in src.items()}
+def metavalue(v):
+ return (v, b'', 0)
- def plainvalue(v):
- value, source, level = v
- assert isinstance(source, bytes)
- assert isinstance(level, int)
- return value
+def plaindict(src):
+ return {k: plainvalue(v) for k, v in src.items()}
-else:
- metadict = dict
- metavalue = pycompat.identity
- plaindict = dict
- plainvalue = pycompat.identity
-
+def plainvalue(v):
+ value, source, level = v
+ assert isinstance(source, bytes)
+ assert isinstance(level, int)
+ return value
def with_rconfig(f):
f.__test__ = True
diff --git a/tortoisehg/util/wconfig.py b/tortoisehg/util/wconfig.py
--- a/tortoisehg/util/wconfig.py
+++ b/tortoisehg/util/wconfig.py
@@ -53,23 +53,15 @@ if _hasiniparse:
r'(?P<sep>=\s*)'
r'(?P<value>.*)$')
-if getattr(config_mod.config, 'alter', None):
- # hg >= 5.8 (a3dced4b7b04): config dict is no longer a plain
- # {key: value} dict, but has metadata for each key.
-
- def _packvalue(config, value, source):
- return (value, source, config._current_source_level)
+# Since hg 5.8 (a3dced4b7b04), config dict is no longer a plain
+# {key: value} dict, but has metadata for each key.
- def _unpackvalue(packed):
- value, _source, _level = packed
- return value
+def _packvalue(config, value, source):
+ return (value, source, config._current_source_level)
-else:
- def _packvalue(config, value, source):
- return value
-
- def _unpackvalue(value):
- return value
+def _unpackvalue(packed):
+ value, _source, _level = packed
+ return value
class _wsortdict(object):
"""Wrapper for config.sortdict to record set/del operations"""