# HG changeset patch # User Boris Feld # Date 1496174968 -7200 # Node ID 8ac4ceac5d96e1fb50b6a775ae99de086dfd91d9 # Parent 7f280af7a89bf3e8429652741842569f033b6f61 template: fix successors and precursors templates In mercurial 4.1-, the gen argument is expected to be an iterator and not an iterable, fix successors and precursors templates. diff -r 7f280af7a89b -r 8ac4ceac5d96 hgext3rd/evolve/templatekw.py --- a/hgext3rd/evolve/templatekw.py Tue May 30 19:59:57 2017 +0200 +++ b/hgext3rd/evolve/templatekw.py Tue May 30 22:09:28 2017 +0200 @@ -69,10 +69,13 @@ displayed """ precursors = sorted(closestprecursors(repo, ctx.node())) + # <= 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}, + # + # They also requires an iterator instead of an iterable. + gen = iter(" ".join(map(node.short, precursors))) + return templatekw._hybrid(gen.__iter__(), precursors, lambda x: {'precursor': x}, lambda d: "%s" % node.short(d['precursor'])) def closestsuccessors(repo, nodeid): @@ -95,12 +98,12 @@ for ss in ssets: subgen = '[%s]' % ', '.join(map(node.short, ss)) gen.append(subgen) - h = templatekw._hybrid(subgen, ss, lambda x: {'successor': x}, + h = templatekw._hybrid(iter(subgen), ss, lambda x: {'successor': x}, lambda d: "%s" % d["successor"]) data.append(h) gen = ', '.join(gen) - return templatekw._hybrid(gen, data, lambda x: {'successorset': x}, + return templatekw._hybrid(iter(gen), data, lambda x: {'successorset': x}, lambda d: d["successorset"]) @eh.templatekw("obsfate_quiet")