Patchwork [3,of,4] templatekw: move shownames() helper to be sorted alphabetically

login
register
mail settings
Submitter Yuya Nishihara
Date Jan. 16, 2016, 12:47 p.m.
Message ID <ba3ea5de17b6e47f6d00.1452948472@mimosa>
Download mbox | patch
Permalink /patch/12796/
State Accepted
Headers show

Comments

Yuya Nishihara - Jan. 16, 2016, 12:47 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1452610436 -32400
#      Tue Jan 12 23:53:56 2016 +0900
# Node ID ba3ea5de17b6e47f6d004d239c5acfe6a408eef6
# Parent  45706351a9bbc0060956521951ab319ffbd22b76
templatekw: move shownames() helper to be sorted alphabetically

I'll add shownamespaces(), which is similar to this function. I want to put
them nearby.

Patch

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