Patchwork [5,of,9] templatekw: mark _showlist() as deprecated (API)

login
register
mail settings
Submitter Yuya Nishihara
Date March 21, 2018, 1:51 p.m.
Message ID <a348ff11094fab5fb2ca.1521640313@mimosa>
Download mbox | patch
Permalink /patch/29691/
State Accepted
Headers show

Comments

Yuya Nishihara - March 21, 2018, 1:51 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1521209515 -32400
#      Fri Mar 16 23:11:55 2018 +0900
# Node ID a348ff11094fab5fb2ca565eef4333c92d8d70d5
# Parent  fb45cb16834ac9919f7a8b4678fb31ed74d3ffcd
templatekw: mark _showlist() as deprecated (API)

.. api::

   ``templatekw._showlist()`` is deprecated in favor of
   ``templateutil._showcompatlist()``, which takes ``context`` in place of
   ``templ``.

Patch

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -36,6 +36,10 @@  compatlist = templateutil.compatlist
 _showcompatlist = templateutil._showcompatlist
 
 def _showlist(name, values, templ, mapping, plural=None, separator=' '):
+    ui = mapping.get('ui')
+    if ui:
+        ui.deprecwarn("templatekw._showlist() is deprecated, use "
+                      "templateutil._showcompatlist()", '4.6')
     context = templ  # this is actually a template context, not a templater
     return _showcompatlist(context, mapping, name, values, plural, separator)