Patchwork [7,of,8] templatekw: get rid of temporary dicts from shownamespaces()

login
register
mail settings
Submitter Yuya Nishihara
Date Oct. 6, 2017, 4:05 p.m.
Message ID <099e1c38ca3b261be0b8.1507305957@mimosa>
Download mbox | patch
Permalink /patch/24608/
State Accepted
Headers show

Comments

Yuya Nishihara - Oct. 6, 2017, 4:05 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1506757824 -3600
#      Sat Sep 30 08:50:24 2017 +0100
# Node ID 099e1c38ca3b261be0b89298356a1ec5ff9d32b5
# Parent  37a60d44b96923c3e1612986020eb266dc7e122d
templatekw: get rid of temporary dicts from shownamespaces()

Patch

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -618,13 +618,9 @@  def shownamespaces(**args):
     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 @@  def shownamespaces(**args):
         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)