Patchwork [6,of,7] hgweb: wrap {whyunstable} with mappinggenerator

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

Comments

Yuya Nishihara - May 9, 2018, 1:33 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1522763733 -32400
#      Tue Apr 03 22:55:33 2018 +0900
# Node ID 8fe4f6447737dd880cff0c3d43327e3e5e64d250
# Parent  20330c4fe13bd19941e56152e6b525b336d54e07
hgweb: wrap {whyunstable} with mappinggenerator

This is also a generator of mappings, which needs a wrapper.

Patch

diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -392,7 +392,7 @@  def succsandmarkers(context, mapping):
 # teach templater succsandmarkers is switched to (context, mapping) API
 succsandmarkers._requires = {'repo', 'ctx'}
 
-def whyunstable(context, mapping):
+def _whyunstablegen(context, mapping):
     repo = context.resource(mapping, 'repo')
     ctx = context.resource(mapping, 'ctx')
 
@@ -402,6 +402,9 @@  def whyunstable(context, mapping):
             entry['divergentnodes'] = _siblings(entry['divergentnodes'])
         yield entry
 
+def whyunstable(context, mapping):
+    return templateutil.mappinggenerator(_whyunstablegen, args=(mapping,))
+
 whyunstable._requires = {'repo', 'ctx'}
 
 def commonentry(repo, ctx):