templatekw: deprecate showdict() and showlist() (API)
.. api::
templatekw.showdict() and showlist() are deprecated in favor of new
(context, mapping) API. Switch the keyword function to new API and use
templatekw.compatdict() and compatlist() instead.
--- a/mercurial/templatekw.py Sun Feb 25 19:25:14 2018 +0900
+++ b/mercurial/templatekw.py Sun Feb 25 19:34:35 2018 +0900
@@ -161,11 +161,19 @@
def showdict(name, data, mapping, plural=None, key='key', value='value',
fmt='%s=%s', separator=' '):
+ ui = mapping.get('ui')
+ if ui:
+ ui.deprecwarn("templatekw.showdict() is deprecated, use compatdict()",
+ '4.6')
c = [{key: k, value: v} for k, v in data.iteritems()]
f = _showlist(name, c, mapping['templ'], mapping, plural, separator)
return hybriddict(data, key=key, value=value, fmt=fmt, gen=f)
def showlist(name, values, mapping, plural=None, element=None, separator=' '):
+ ui = mapping.get('ui')
+ if ui:
+ ui.deprecwarn("templatekw.showlist() is deprecated, use compatlist()",
+ '4.6')
if not element:
element = name
f = _showlist(name, values, mapping['templ'], mapping, plural, separator)