changeset 38063:3c995af3066e

hgweb: wrap {entries}* of tags with mappinggenerator They were functions returning a generator of mappings. The laziness is handled by the mappinggenerator class.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 04 Apr 2018 20:18:28 +0900
parents 17f7b44367bb
children 46e8abc4eb04
files mercurial/hgweb/webcommands.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Wed Apr 04 20:14:19 2018 +0900
+++ b/mercurial/hgweb/webcommands.py	Wed Apr 04 20:18:28 2018 +0900
@@ -611,7 +611,7 @@
     i = list(reversed(web.repo.tagslist()))
     parity = paritygen(web.stripecount)
 
-    def entries(notip, latestonly, **map):
+    def entries(context, notip, latestonly):
         t = i
         if notip:
             t = [(k, n) for k, n in i if k != "tip"]
@@ -626,9 +626,10 @@
     return web.sendtemplate(
         'tags',
         node=hex(web.repo.changelog.tip()),
-        entries=lambda **x: entries(False, False, **x),
-        entriesnotip=lambda **x: entries(True, False, **x),
-        latestentry=lambda **x: entries(True, True, **x))
+        entries=templateutil.mappinggenerator(entries, args=(False, False)),
+        entriesnotip=templateutil.mappinggenerator(entries,
+                                                   args=(True, False)),
+        latestentry=templateutil.mappinggenerator(entries, args=(True, True)))
 
 @webcommand('bookmarks')
 def bookmarks(web):