Re: [PATCH 10 of 10] templatekw: deprecate showdict() and showlist() (API)

2018-03-02 Thread Augie Fackler
On Thu, Mar 01, 2018 at 08:52:00PM -0500, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1519554875 -32400
> #  Sun Feb 25 19:34:35 2018 +0900
> # Node ID d6bbe8dfafaeb32e48b38c1815dda69ca0854a5e
> # Parent  0e49bbe25cdc0eb0898737dd4f584e89f8b8eb6a
> templatekw: deprecate showdict() and showlist() (API)

queued, thanks
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 10 of 10] templatekw: deprecate showdict() and showlist() (API)

2018-03-01 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# 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)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel