changeset 36628:c9dcc379e2dc

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.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 25 Feb 2018 19:34:35 +0900
parents c3f9d0c303e8
children 95bd9e396774
files mercurial/templatekw.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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)