templatekw: move shownames() helper to be sorted alphabetically
I'll add shownamespaces(), which is similar to this function. I want to put
them nearby.
--- a/mercurial/templatekw.py Sat Jan 16 13:53:32 2016 +0900
+++ b/mercurial/templatekw.py Tue Jan 12 23:53:56 2016 +0900
@@ -413,6 +413,14 @@
args.update({'rev': repo.manifest.rev(mnode), 'node': hex(mnode)})
return templ('manifest', **args)
+def shownames(namespace, **args):
+ """helper method to generate a template keyword for a namespace"""
+ ctx = args['ctx']
+ repo = ctx.repo()
+ ns = repo.names[namespace]
+ names = ns.names(repo, ctx.node())
+ return showlist(ns.templatename, names, plural=namespace, **args)
+
def shownode(repo, ctx, templ, **args):
""":node: String. The changeset identification hash, as a 40 hexadecimal
digit string.
@@ -489,14 +497,6 @@
subrepos.append(sub) # removed in ctx
return showlist('subrepo', sorted(subrepos), **args)
-def shownames(namespace, **args):
- """helper method to generate a template keyword for a namespace"""
- ctx = args['ctx']
- repo = ctx.repo()
- ns = repo.names[namespace]
- names = ns.names(repo, ctx.node())
- return showlist(ns.templatename, names, plural=namespace, **args)
-
# don't remove "showtags" definition, even though namespaces will put
# a helper function for "tags" keyword into "keywords" map automatically,
# because online help text is built without namespaces initialization