Patchwork templatekw: change default value of 'requires' to ()

login
register
mail settings
Submitter Yuya Nishihara
Date May 20, 2019, 12:18 p.m.
Message ID <02824c3b34ea718a47b0.1558354731@mimosa>
Download mbox | patch
Permalink /patch/40145/
State Accepted
Headers show

Comments

Yuya Nishihara - May 20, 2019, 12:18 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1558309254 -32400
#      Mon May 20 08:40:54 2019 +0900
# Node ID 02824c3b34ea718a47b06ba9ac43c17dcf50aed3
# Parent  832c59d1196e8088102500992ee0e0a32e49226e
templatekw: change default value of 'requires' to ()

Since we dropped support for the old-style template keywords, we no longer
have to distinguish None (old-style) and an empty requirement (new-style).
Augie Fackler - May 20, 2019, 3:33 p.m.
On Mon, May 20, 2019 at 09:18:51PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1558309254 -32400
> #      Mon May 20 08:40:54 2019 +0900
> # Node ID 02824c3b34ea718a47b06ba9ac43c17dcf50aed3
> # Parent  832c59d1196e8088102500992ee0e0a32e49226e
> templatekw: change default value of 'requires' to ()

queued, thanks

Patch

diff --git a/mercurial/registrar.py b/mercurial/registrar.py
--- a/mercurial/registrar.py
+++ b/mercurial/registrar.py
@@ -341,9 +341,7 @@  class templatekeyword(_templateregistrar
     The first string argument is used also in online help.
 
     Optional argument 'requires' should be a collection of resource names
-    which the template keyword depends on. This also serves as a flag to
-    switch to the new API. If 'requires' is unspecified, all template
-    keywords and resources are expanded to the function arguments.
+    which the template keyword depends on.
 
     'templatekeyword' instance in example above can be used to
     decorate multiple functions.
@@ -355,7 +353,7 @@  class templatekeyword(_templateregistrar
     Otherwise, explicit 'templatekw.loadkeyword()' is needed.
     """
 
-    def _extrasetup(self, name, func, requires=None):
+    def _extrasetup(self, name, func, requires=()):
         func._requires = requires
 
 class templatefilter(_templateregistrarbase):