changeset 37951:c4313a9fde7b

hgweb: use template context to render {files} of changesetentry() This is a preferred way to process nested templates.
author Yuya Nishihara <yuya@tcha.org>
date Tue, 03 Apr 2018 23:31:11 +0900
parents 790ca0c11fd4
children 028d7c24f2e5
files mercurial/hgweb/webutil.py
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/webutil.py	Tue Apr 03 23:29:11 2018 +0900
+++ b/mercurial/hgweb/webutil.py	Tue Apr 03 23:31:11 2018 +0900
@@ -463,11 +463,11 @@
     else:
         return short(ctx.node())
 
-def _listfilesgen(context, tmpl, ctx, stripecount):
+def _listfilesgen(context, ctx, stripecount):
     parity = paritygen(stripecount)
     for blockno, f in enumerate(ctx.files()):
         template = 'filenodelink' if f in ctx else 'filenolink'
-        yield tmpl.generate(template, {
+        yield context.process(template, {
             'node': ctx.hex(),
             'file': f,
             'blockno': blockno + 1,
@@ -503,8 +503,7 @@
         changesetbookmark=showbookmarks,
         changesetbranch=showbranch,
         files=templateutil.mappedgenerator(_listfilesgen,
-                                           args=(web.tmpl, ctx,
-                                                 web.stripecount)),
+                                           args=(ctx, web.stripecount)),
         diffsummary=lambda **x: diffsummary(diffstatsgen),
         diffstat=diffstats,
         archives=web.archivelist(ctx.hex()),