changeset 37994:790ca0c11fd4

hgweb: wrap {files} of changesetentry() with mappedgenerator This can't be easily adapted to mappinggenerator because the associated templates are switched per item.
author Yuya Nishihara <yuya@tcha.org>
date Tue, 03 Apr 2018 23:29:11 +0900
parents 1129e444fd6c
children c4313a9fde7b
files mercurial/hgweb/webutil.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/webutil.py	Tue Apr 03 23:25:32 2018 +0900
+++ b/mercurial/hgweb/webutil.py	Tue Apr 03 23:29:11 2018 +0900
@@ -463,7 +463,7 @@
     else:
         return short(ctx.node())
 
-def _listfilesgen(tmpl, ctx, stripecount):
+def _listfilesgen(context, tmpl, ctx, stripecount):
     parity = paritygen(stripecount)
     for blockno, f in enumerate(ctx.files()):
         template = 'filenodelink' if f in ctx else 'filenolink'
@@ -502,7 +502,9 @@
         changesettag=showtags,
         changesetbookmark=showbookmarks,
         changesetbranch=showbranch,
-        files=list(_listfilesgen(web.tmpl, ctx, web.stripecount)),
+        files=templateutil.mappedgenerator(_listfilesgen,
+                                           args=(web.tmpl, ctx,
+                                                 web.stripecount)),
         diffsummary=lambda **x: diffsummary(diffstatsgen),
         diffstat=diffstats,
         archives=web.archivelist(ctx.hex()),