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

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


# HG changeset patch
# User Yuya Nishihara <yuya at 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.

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):


More information about the Mercurial-devel mailing list