changeset 2526:f4acfbb36191

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.
author Boris Feld <boris.feld@octobus.net>
date Tue, 30 May 2017 19:43:14 +0200
parents 5adb8bdb935e
children 7f280af7a89b
files hgext3rd/evolve/templatekw.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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):