templatekw: deprecate showdict() and showlist() (API)
authorYuya Nishihara <yuya@tcha.org>
Sun, 25 Feb 2018 19:34:35 +0900
changeset 36599 c9dcc379e2dc
parent 36598 c3f9d0c303e8
child 36600 95bd9e396774
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.
mercurial/templatekw.py
--- 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)