templatekw: get rid of temporary dicts from shownamespaces()
authorYuya Nishihara <yuya@tcha.org>
Sat, 30 Sep 2017 08:50:24 +0100
changeset 34540 1c7c4445686f
parent 34539 f30e59703d98
child 34541 0a0a72c043ac
templatekw: get rid of temporary dicts from shownamespaces()
mercurial/templatekw.py
--- 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)