changeset 37958:10d3dc8123c5

hgweb: wrap {succsandmarkers} with mappinggenerator This is also a generator of mappings, which needs a wrapper.
author Yuya Nishihara <yuya@tcha.org>
date Tue, 03 Apr 2018 22:54:36 +0900
parents 89db78126f7f
children 3dc4045db164
files mercurial/hgweb/webutil.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/webutil.py	Mon Apr 02 00:46:33 2018 +0900
+++ b/mercurial/hgweb/webutil.py	Tue Apr 03 22:54:36 2018 +0900
@@ -378,7 +378,7 @@
 def formatlinerange(fromline, toline):
     return '%d:%d' % (fromline + 1, toline)
 
-def succsandmarkers(context, mapping):
+def _succsandmarkersgen(context, mapping):
     repo = context.resource(mapping, 'repo')
     itemmappings = templatekw.showsuccsandmarkers(context, mapping)
     for item in itemmappings.tovalue(context, mapping):
@@ -386,6 +386,9 @@
                                        for successor in item['successors'])
         yield item
 
+def succsandmarkers(context, mapping):
+    return templateutil.mappinggenerator(_succsandmarkersgen, args=(mapping,))
+
 # teach templater succsandmarkers is switched to (context, mapping) API
 succsandmarkers._requires = {'repo', 'ctx'}