template: fix precursors template for older mercurial version
authorBoris Feld <boris.feld@octobus.net>
Tue, 30 May 2017 19:43:14 +0200
changeset 2526 f4acfbb36191
parent 2525 5adb8bdb935e
child 2527 7f280af7a89b
template: fix precursors template for older mercurial version In mercurial 4.1 and below templatekw._hybrid require the gen argument to be different than None. Manually compute the same default output for these older mercurial versions.
hgext3rd/evolve/templatekw.py
--- a/hgext3rd/evolve/templatekw.py	Tue May 30 13:16:43 2017 +0200
+++ b/hgext3rd/evolve/templatekw.py	Tue May 30 19:43:14 2017 +0200
@@ -69,7 +69,10 @@
     displayed
     """
     precursors = sorted(closestprecursors(repo, ctx.node()))
-    return templatekw._hybrid(None, precursors, lambda x: {'precursor': x},
+    # <= hg-4.1 requires an explicite gen.
+    # we can use None once the support is dropped
+    gen = " ".join(map(node.short, precursors))
+    return templatekw._hybrid(gen, precursors, lambda x: {'precursor': x},
                               lambda d: "%s" % node.short(d['precursor']))
 
 def closestsuccessors(repo, nodeid):