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

login
register
mail settings
Submitter Yuya Nishihara
Date May 9, 2018, 1:33 p.m.
Message ID <dd0c574b7d3565fdaefd.1525872785@mimosa>
Download mbox | patch
Permalink /patch/31430/
State Accepted
Headers show

Comments

Yuya Nishihara - May 9, 2018, 1:33 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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.

Patch

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('/')