hgext3rd/evolve/templatekw.py
changeset 2500 2092007af205
parent 2494 17bc96b54255
child 2502 d5db7464676d
--- a/hgext3rd/evolve/templatekw.py	Mon May 29 17:16:15 2017 +0200
+++ b/hgext3rd/evolve/templatekw.py	Mon May 29 12:15:47 2017 +0200
@@ -64,17 +64,13 @@
                 stack.append(precnodeid)
 
 @eh.templatekw("precursors")
-def shownextvisibleprecursors(repo, ctx, templ, **args):
+def shownextvisibleprecursors(repo, ctx, **args):
     """Returns a string containing the list if the closest successors
     displayed
     """
-    # XXX-review: I've added a couple of 'XXX' for future work.
-
-    # XXX: template logic supports lists, so we should more to using a list at some point
-
-    # XXX: I think we could returns something close to a "changectx" that would allow template to alter the way we render this.
-    shortnodes = map(node.short, sorted(closestprecursors(repo, ctx.node())))
-    return ', '.join(shortnodes)
+    precursors = sorted(closestprecursors(repo, ctx.node()))
+    return templatekw._hybrid(None, precursors, lambda x: {'precursor': x},
+                              lambda d: "%s" % node.short(d['precursor']))
 
 def closestsuccessors(repo, nodeid):
     """ returns the closest visible successors sets instead.