templatekw: fix return type of {succsandmarkers} (BC)
authorYuya Nishihara <yuya@tcha.org>
Mon, 19 Mar 2018 20:23:27 +0900
changeset 37503 49a8c2cc7978
parent 37502 40c7347f6848
child 37504 901e749ca0e1
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.
mercurial/hgweb/webutil.py
mercurial/templatekw.py
--- 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):