[PATCH 2 of 4] templatekw: update namespace calls

Sean Farley sean.michael.farley at gmail.com
Fri Jan 2 17:42:03 CST 2015


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1419199312 28800
#      Sun Dec 21 14:01:52 2014 -0800
# Node ID 13a462c900a74cae0973571857f455c7dd54d0c0
# Parent  165fc028b31c989af76a944c5ecfbbbb19579629
templatekw: update namespace calls

Previous patches changed the namespace api to be more of an object-oriented
approach. This patch updates the template function to use said api changes.

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -376,13 +376,13 @@ def showsubrepos(**args):
 
 def shownames(namespace, **args):
     """helper method to generate a template keyword for a namespace"""
     ctx = args['ctx']
     repo = ctx._repo
-    names = repo.names.names(repo, namespace, ctx.node())
-    return showlist(repo.names.templatename(namespace), names,
-                    plural=namespace, **args)
+    ns = repo.names[namespace]
+    names = ns.names(repo, ctx.node())
+    return showlist(ns.templatename, names, plural=namespace, **args)
 
 # keywords are callables like:
 # fn(repo, ctx, templ, cache, revcache, **args)
 # with:
 # repo - current repository instance


More information about the Mercurial-devel mailing list