changeset 37503:49a8c2cc7978

templatekw: fix return type of {succsandmarkers} (BC) A hybrid object represents a list/dict of values, but {succsandmarkers} returns a list of template mappings. This change means old-style list templates (e.g. "start_succsandmarkers") are no longer supported, but that should be okay since {succsandmarkers} is still experimental and relatively new.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 19 Mar 2018 20:23:27 +0900
parents 40c7347f6848
children 901e749ca0e1
files mercurial/hgweb/webutil.py mercurial/templatekw.py
diffstat 2 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/webutil.py	Sat Mar 17 23:34:38 2018 +0900
+++ b/mercurial/hgweb/webutil.py	Mon Mar 19 20:23:27 2018 +0900
@@ -355,7 +355,8 @@
 
 def succsandmarkers(context, mapping):
     repo = context.resource(mapping, 'repo')
-    for item in templatekw.showsuccsandmarkers(context, mapping):
+    itemmappings = templatekw.showsuccsandmarkers(context, mapping)
+    for item in itemmappings.tovalue(context, mapping):
         item['successors'] = _siblings(repo[successor]
                                        for successor in item['successors'])
         yield item
--- a/mercurial/templatekw.py	Sat Mar 17 23:34:38 2018 +0900
+++ b/mercurial/templatekw.py	Mon Mar 19 20:23:27 2018 +0900
@@ -501,7 +501,7 @@
     repo = context.resource(mapping, 'repo')
     values = []
 
-    for x in succsandmarkers:
+    for x in succsandmarkers.tovalue(context, mapping):
         v = obsutil.obsfateprinter(ui, repo, x['successors'], x['markers'],
                                    scmutil.formatchangeid)
         values.append(v)
@@ -663,8 +663,7 @@
 
         data.append({'successors': successors, 'markers': finalmarkers})
 
-    f = _showcompatlist(context, mapping, 'succsandmarkers', data)
-    return _hybrid(f, data, lambda x: x, pycompat.identity)
+    return templateutil.mappinglist(data)
 
 @templatekeyword('p1rev', requires={'ctx'})
 def showp1rev(context, mapping):