[PATCH 10 of 10] templatekw: deprecate showdict() and showlist() (API)
Yuya Nishihara
yuya at tcha.org
Fri Mar 2 01:52:00 UTC 2018
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1519554875 -32400
# Sun Feb 25 19:34:35 2018 +0900
# Node ID d6bbe8dfafaeb32e48b38c1815dda69ca0854a5e
# Parent 0e49bbe25cdc0eb0898737dd4f584e89f8b8eb6a
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.
diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -161,11 +161,19 @@ def compatlist(context, mapping, name, d
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)
More information about the Mercurial-devel
mailing list