changeset 37508:30a7b32897f1

hgwebdir: wrap {entries} with mappinggenerator No bare generator should be put in a template mapping.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 01 Apr 2018 22:11:58 +0900
parents 9b16a67cef56
children cb7b275c0cd0
files mercurial/hgweb/hgwebdir_mod.py
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/hgwebdir_mod.py	Fri Apr 06 09:53:17 2018 -0700
+++ b/mercurial/hgweb/hgwebdir_mod.py	Sun Apr 01 22:11:58 2018 +0900
@@ -35,6 +35,7 @@
     pycompat,
     scmutil,
     templater,
+    templateutil,
     ui as uimod,
     util,
 )
@@ -246,9 +247,8 @@
 
         yield row
 
-def indexentries(ui, repos, req, stripecount, sortcolumn='',
-                 descending=False, subdir=''):
-
+def _indexentriesgen(context, ui, repos, req, stripecount, sortcolumn,
+                     descending, subdir):
     rows = rawindexentries(ui, repos, req, subdir=subdir)
 
     sortdefault = None, False
@@ -262,6 +262,11 @@
         row['parity'] = parity
         yield row
 
+def indexentries(ui, repos, req, stripecount, sortcolumn='',
+                 descending=False, subdir=''):
+    args = (ui, repos, req, stripecount, sortcolumn, descending, subdir)
+    return templateutil.mappinggenerator(_indexentriesgen, args=args)
+
 class hgwebdir(object):
     """HTTP server for multiple repositories.