diff mercurial/hgweb/webcommands.py @ 37400:47aea60d114d

hgweb: fix search {entries} to not return results of template expansion "{entries%changelogentry}" in raw/search.tmpl was utterly wrong because "{entries}" here was a generator yielding results of template expansion. That's why we have a weird hack in runmap(), which I'm going to get rid of. https://www.mercurial-scm.org/repo/hg/file/4.5.2/mercurial/templater.py#l469 We have two choices: a) drop "%changelogentry" from raw/search.tmpl b) fix "{entries}" to yield mappings I take (b) because that's what the other log-like "{entries}" do. The "entries" keyword is wrapped by mappinggenerator so "{entries}" without "%searchentry" still works.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 18 Mar 2018 20:51:39 +0900
parents 83d537162894
children 7d94fe3ea0ac
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Sat Mar 17 22:47:02 2018 +0900
+++ b/mercurial/hgweb/webcommands.py	Sun Mar 18 20:51:39 2018 +0900
@@ -36,6 +36,7 @@
     scmutil,
     smartset,
     templater,
+    templateutil,
 )
 
 from ..utils import (
@@ -287,7 +288,7 @@
                 LookupError):
             return MODE_KEYWORD, query
 
-    def changelist(**map):
+    def changelist(context):
         count = 0
 
         for ctx in searchfunc[0](funcarg):
@@ -303,7 +304,7 @@
                 'changelogtag': showtags,
                 'files': files,
             })
-            yield web.tmpl.generate('searchentry', lm)
+            yield lm
 
             if count >= revcount:
                 break
@@ -349,7 +350,7 @@
         query=query,
         node=tip.hex(),
         symrev='tip',
-        entries=changelist,
+        entries=templateutil.mappinggenerator(changelist, name='searchentry'),
         archives=web.archivelist('tip'),
         morevars=morevars,
         lessvars=lessvars,