# HG changeset patch # User Yuya Nishihara # Date 2016-01-12 14:53:56 # Node ID b42b2e86ef02303e96d34ba7277621c774efe90e # Parent 83aef8d5bc1bd05027b1f18fe9b986a264aa6951 templatekw: move shownames() helper to be sorted alphabetically I'll add shownamespaces(), which is similar to this function. I want to put them nearby. diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -413,6 +413,14 @@ def showmanifest(**args): 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 @@ def showsubrepos(**args): 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