changeset 37510:876d54f800cf

hgweb: wrap {labels} by hybridlist() This one is a simple list of strings, which can support map operation.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 01 Apr 2018 22:20:44 +0900
parents cb7b275c0cd0
children 356e61e82c2a
files mercurial/hgweb/hgwebdir_mod.py mercurial/hgweb/webcommands.py
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/hgwebdir_mod.py	Sun Apr 01 22:14:36 2018 +0900
+++ b/mercurial/hgweb/hgwebdir_mod.py	Sun Apr 01 22:20:44 2018 +0900
@@ -190,7 +190,7 @@
                    'lastchange_sort': d[1] - d[0],
                    'archives': [],
                    'isdirectory': True,
-                   'labels': [],
+                   'labels': templateutil.hybridlist([], name='label'),
                    }
 
             seendirs.add(name)
@@ -231,6 +231,7 @@
         description = get("web", "description")
         seenrepos.add(name)
         name = get("web", "name", name)
+        labels = u.configlist('web', 'labels', untrusted=True)
         row = {'contact': contact or "unknown",
                'contact_sort': contact.upper() or "unknown",
                'name': name,
@@ -242,7 +243,7 @@
                'lastchange_sort': d[1] - d[0],
                'archives': archivelist(u, "tip", url),
                'isdirectory': None,
-               'labels': u.configlist('web', 'labels', untrusted=True),
+               'labels': templateutil.hybridlist(labels, name='label'),
                }
 
         yield row
--- a/mercurial/hgweb/webcommands.py	Sun Apr 01 22:14:36 2018 +0900
+++ b/mercurial/hgweb/webcommands.py	Sun Apr 01 22:20:44 2018 +0900
@@ -765,6 +765,7 @@
     desc = web.config("web", "description")
     if not desc:
         desc = 'unknown'
+    labels = web.configlist('web', 'labels')
 
     return web.sendtemplate(
         'summary',
@@ -779,7 +780,7 @@
         node=tip.hex(),
         symrev='tip',
         archives=web.archivelist('tip'),
-        labels=web.configlist('web', 'labels'))
+        labels=templateutil.hybridlist(labels, name='label'))
 
 @webcommand('filediff')
 def filediff(web):