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

login
register
mail settings
Submitter Yuya Nishihara
Date April 7, 2018, 9:05 a.m.
Message ID <9b162ca00c2c153eba7f.1523091944@mimosa>
Download mbox | patch
Permalink /patch/30539/
State Accepted
Headers show

Comments

Yuya Nishihara - April 7, 2018, 9:05 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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.
Augie Fackler - April 10, 2018, 2:33 a.m.
On Sat, Apr 07, 2018 at 06:05:44PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@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)

queued, thanks

Patch

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