changeset 34540:1c7c4445686f

templatekw: get rid of temporary dicts from shownamespaces()
author Yuya Nishihara <yuya@tcha.org>
date Sat, 30 Sep 2017 08:50:24 +0100
parents f30e59703d98
children 0a0a72c043ac
files mercurial/templatekw.py
diffstat 1 files changed, 2 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templatekw.py	Mon Sep 18 23:53:05 2017 +0900
+++ b/mercurial/templatekw.py	Sat Sep 30 08:50:24 2017 +0100
@@ -618,13 +618,9 @@
     repo = ctx.repo()
 
     namespaces = util.sortdict()
-    colornames = {}
-    builtins = {}
 
     for k, ns in repo.names.iteritems():
         namespaces[k] = showlist('name', ns.names(repo, ctx.node()), args)
-        colornames[k] = ns.colorname
-        builtins[k] = ns.builtin
 
     f = _showlist('namespace', list(namespaces), args)
 
@@ -632,8 +628,8 @@
         return {
             'namespace': ns,
             'names': namespaces[ns],
-            'builtin': builtins[ns],
-            'colorname': colornames[ns],
+            'builtin': repo.names[ns].builtin,
+            'colorname': repo.names[ns].colorname,
         }
 
     return _hybrid(f, namespaces, makemap, pycompat.identity)