Patchwork [4,of,8] hgweb: wrap {annotate} with mappinggenerator

login
register
mail settings
Submitter Yuya Nishihara
Date May 21, 2018, 12:22 p.m.
Message ID <6970d3a9c6a4ee333a1a.1526905361@mimosa>
Download mbox | patch
Permalink /patch/31771/
State Accepted
Headers show

Comments

Yuya Nishihara - May 21, 2018, 12:22 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1522841331 -32400
#      Wed Apr 04 20:28:51 2018 +0900
# Node ID 6970d3a9c6a4ee333a1a10abccfa40a8771af471
# Parent  7da55cdf4a0846788d92775adfec37de79c7a925
hgweb: wrap {annotate} with mappinggenerator

No bare generator of mappings should be put in a template mapping.

Patch

diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -943,7 +943,7 @@  def annotate(web):
         for p in parentscache[rev]:
             yield p
 
-    def annotate(**map):
+    def annotate(context):
         if fctx.isbinary():
             mt = (mimetypes.guess_type(fctx.path())[0]
                   or 'application/octet-stream')
@@ -986,7 +986,7 @@  def annotate(web):
     return web.sendtemplate(
         'fileannotate',
         file=f,
-        annotate=annotate,
+        annotate=templateutil.mappinggenerator(annotate),
         path=webutil.up(f),
         symrev=webutil.symrevorshortnode(web.req, fctx),
         rename=webutil.renamelink(fctx),