[PATCH 5 of 5] templatekw: fix return type of {succsandmarkers} (BC)

Yuya Nishihara yuya at tcha.org
Sat Apr 7 05:05:44 EDT 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1521458607 -32400
#      Mon Mar 19 20:23:27 2018 +0900
# Node ID 9b162ca00c2c153eba7f2cdd7bbfe344e0b5a195
# Parent  575c4d56f14ef75c8dd779062d66258d5c62c5ca
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.

diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -355,7 +355,8 @@ def formatlinerange(fromline, toline):
 
 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
diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -501,7 +501,7 @@ def showobsfate(context, mapping):
     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 @@ def showsuccsandmarkers(context, mapping
 
         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):


More information about the Mercurial-devel mailing list