changeset 36592:b0054f3c055a

namespace: use registrar to add template keyword Prepares for switching to the new API.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 25 Feb 2018 18:56:06 +0900
parents 121a20e5da56
children 900e5ee44307
files mercurial/namespaces.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/namespaces.py	Sun Feb 25 16:45:44 2018 +0900
+++ b/mercurial/namespaces.py	Sun Feb 25 18:56:06 2018 +0900
@@ -2,6 +2,7 @@
 
 from .i18n import _
 from . import (
+    registrar,
     templatekw,
     util,
 )
@@ -87,11 +88,11 @@
 
         # we only generate a template keyword if one does not already exist
         if namespace.name not in templatekw.keywords:
+            templatekeyword = registrar.templatekeyword(templatekw.keywords)
+            @templatekeyword(namespace.name)
             def generatekw(**args):
                 return templatekw.shownames(namespace.name, **args)
 
-            templatekw.keywords[namespace.name] = generatekw
-
     def singlenode(self, repo, name):
         """
         Return the 'best' node for the given name. Best means the first node