namespace: use registrar to add template keyword
Prepares for switching to the new API.
--- 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