[PATCH 4 of 8] hgweb: fix summary {tags} and {shortlog} to not forcibly expand template
Yuya Nishihara
yuya at tcha.org
Thu Apr 5 10:37:22 EDT 2018
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1521376543 -32400
# Sun Mar 18 21:35:43 2018 +0900
# Node ID 9e623cb78522c9a52eeb25092c75b7f439c9e045
# Parent 083ce2cf66079739b029f7e067a2e9339704c006
hgweb: fix summary {tags} and {shortlog} to not forcibly expand template
The same sort of bug as the previous patch. In this case, JSON template was
wrong.
diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -713,7 +713,7 @@ def summary(web):
"""
i = reversed(web.repo.tagslist())
- def tagentries(**map):
+ def tagentries(context):
parity = paritygen(web.stripecount)
count = 0
for k, n in i:
@@ -724,12 +724,12 @@ def summary(web):
if count > 10: # limit to 10 tags
break
- yield web.tmpl.generate('tagentry', {
+ yield {
'parity': next(parity),
'tag': k,
'node': hex(n),
'date': web.repo[n].date(),
- })
+ }
def bookmarks(**map):
parity = paritygen(web.stripecount)
@@ -742,7 +742,7 @@ def summary(web):
'date': web.repo[n].date(),
'node': hex(n)}
- def changelist(**map):
+ def changelist(context):
parity = paritygen(web.stripecount, offset=start - end)
l = [] # build a list in forward order for efficiency
revs = []
@@ -752,7 +752,7 @@ def summary(web):
ctx = web.repo[i]
lm = webutil.commonentry(web.repo, ctx)
lm['parity'] = next(parity)
- l.append(web.tmpl.generate('shortlogentry', lm))
+ l.append(lm)
for entry in reversed(l):
yield entry
@@ -771,10 +771,11 @@ def summary(web):
desc=desc,
owner=get_contact(web.config) or 'unknown',
lastchange=tip.date(),
- tags=tagentries,
+ tags=templateutil.mappinggenerator(tagentries, name='tagentry'),
bookmarks=bookmarks,
branches=webutil.branchentries(web.repo, web.stripecount, 10),
- shortlog=changelist,
+ shortlog=templateutil.mappinggenerator(changelist,
+ name='shortlogentry'),
node=tip.hex(),
symrev='tip',
archives=web.archivelist('tip'),
diff --git a/mercurial/templates/gitweb/summary.tmpl b/mercurial/templates/gitweb/summary.tmpl
--- a/mercurial/templates/gitweb/summary.tmpl
+++ b/mercurial/templates/gitweb/summary.tmpl
@@ -36,13 +36,13 @@ summary |
<div><a class="title" href="{url|urlescape}shortlog{sessionvars%urlparameter}">changes</a></div>
<table cellspacing="0">
-{shortlog}
+{shortlog%shortlogentry}
<tr class="light"><td colspan="4"><a class="list" href="{url|urlescape}shortlog{sessionvars%urlparameter}">...</a></td></tr>
</table>
<div><a class="title" href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a></div>
<table cellspacing="0">
-{tags}
+{tags%tagentry}
<tr class="light"><td colspan="3"><a class="list" href="{url|urlescape}tags{sessionvars%urlparameter}">...</a></td></tr>
</table>
diff --git a/mercurial/templates/monoblue/summary.tmpl b/mercurial/templates/monoblue/summary.tmpl
--- a/mercurial/templates/monoblue/summary.tmpl
+++ b/mercurial/templates/monoblue/summary.tmpl
@@ -39,7 +39,7 @@
<h2><a href="{url|urlescape}shortlog{sessionvars%urlparameter}">Changes</a></h2>
<table>
-{shortlog}
+{shortlog%shortlogentry}
<tr class="light">
<td colspan="4"><a class="list" href="{url|urlescape}shortlog{sessionvars%urlparameter}">...</a></td>
</tr>
@@ -47,7 +47,7 @@
<h2><a href="{url|urlescape}tags{sessionvars%urlparameter}">Tags</a></h2>
<table>
-{tags}
+{tags%tagentry}
<tr class="light">
<td colspan="3"><a class="list" href="{url|urlescape}tags{sessionvars%urlparameter}">...</a></td>
</tr>
More information about the Mercurial-devel
mailing list