[PATCH 3 of 8] hgweb: wrap {labels} by hybridlist()
Yuya Nishihara
yuya at tcha.org
Tue Apr 10 11:41:36 EDT 2018
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1522588844 -32400
# Sun Apr 01 22:20:44 2018 +0900
# Node ID 411dfde85bce520eb637ea52bce93e336b9e9a30
# Parent 42132043359a74ab3d703f1791644a39b8b6e8dc
hgweb: wrap {labels} by hybridlist()
This one is a simple list of strings, which can support map operation.
diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py
+++ b/mercurial/hgweb/hgwebdir_mod.py
@@ -190,7 +190,7 @@ def rawindexentries(ui, repos, req, subd
'lastchange_sort': d[1] - d[0],
'archives': [],
'isdirectory': True,
- 'labels': [],
+ 'labels': templateutil.hybridlist([], name='label'),
}
seendirs.add(name)
@@ -231,6 +231,7 @@ def rawindexentries(ui, repos, req, subd
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 @@ def rawindexentries(ui, repos, req, subd
'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
diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -765,6 +765,7 @@ def summary(web):
desc = web.config("web", "description")
if not desc:
desc = 'unknown'
+ labels = web.configlist('web', 'labels')
return web.sendtemplate(
'summary',
@@ -779,7 +780,7 @@ def summary(web):
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):
More information about the Mercurial-devel
mailing list