[PATCH 4 of 7] hgweb: wrap {branches} and {entries} of branches with mappinggenerator

Yuya Nishihara yuya at tcha.org
Wed May 9 09:33:05 EDT 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1522597593 -32400
#      Mon Apr 02 00:46:33 2018 +0900
# Node ID dd0c574b7d3565fdaefd222d6448b9468516d640
# Parent  51ef216f8ee928ccb229e92651db015fe86f5117
hgweb: wrap {branches} and {entries} of branches with mappinggenerator

Bare generator of mappings shouldn't be put in a template mapping because
its type can't be determined without consuming it.

diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -292,7 +292,7 @@ def branchentries(repo, stripecount, lim
     parity = paritygen(stripecount)
     sortkey = lambda item: (not item[1], item[0].rev())
 
-    def entries(**map):
+    def entries(context):
         count = 0
         if not tips:
             for tag, hs, tip, closed in repo.branchmap().iterbranches():
@@ -315,7 +315,7 @@ def branchentries(repo, stripecount, lim
                 'date': ctx.date()
             }
 
-    return entries
+    return templateutil.mappinggenerator(entries)
 
 def cleanpath(repo, path):
     path = path.lstrip('/')


More information about the Mercurial-devel mailing list