Mercurial > hg
changeset 37911:26aed0d561e8
hgweb: wrap {changelogtag}, {changesettag}, and {changesetbookmark}
These can't be hybrid lists as they've associated with named template, 't1'.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Mon, 02 Apr 2018 00:39:26 +0900 |
parents | ec03f3aa2d14 |
children | 16c7a6ac8f94 |
files | mercurial/hgweb/webutil.py |
diffstat | 1 files changed, 8 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/webutil.py Mon Apr 02 00:29:31 2018 +0900 +++ b/mercurial/hgweb/webutil.py Mon Apr 02 00:39:26 2018 +0900 @@ -274,15 +274,17 @@ branches.append(branch) return templateutil.hybridlist(branches, name='name') +def _nodenamesgen(context, f, node, name): + for t in f(node): + yield {name: t} + def showtag(repo, tmpl, t1, node=nullid): - for t in repo.nodetags(node): - lm = {'tag': t} - yield tmpl.generate(t1, lm) + args = (repo.nodetags, node, 'tag') + return templateutil.mappinggenerator(_nodenamesgen, args=args, name=t1) def showbookmark(repo, tmpl, t1, node=nullid): - for t in repo.nodebookmarks(node): - lm = {'bookmark': t} - yield tmpl.generate(t1, lm) + args = (repo.nodebookmarks, node, 'bookmark') + return templateutil.mappinggenerator(_nodenamesgen, args=args, name=t1) def branchentries(repo, stripecount, limit=0): tips = []