# HG changeset patch # User Pierre-Yves David # Date 1542591696 0 # Node ID 7661706dc14df7b10029c01cb9ed5ad6866c2909 # Parent 8e891b4a54e86b6aa87182f7b5dd2fc9b85e9085 compat: drop 4.3 compatiblity code for 'precursors' revset diff -r 8e891b4a54e8 -r 7661706dc14d hgext3rd/evolve/templatekw.py --- a/hgext3rd/evolve/templatekw.py Sat Nov 10 23:54:46 2018 -0500 +++ b/hgext3rd/evolve/templatekw.py Mon Nov 19 01:41:36 2018 +0000 @@ -41,44 +41,7 @@ return templatekw.showlist('trouble', ctx.instabilities(), args, plural='troubles') -if util.safehasattr(templatekw, 'showpredecessors'): - templatekw.keywords["precursors"] = templatekw.showpredecessors -else: - # for version <= hg4.3 - def closestprecursors(repo, nodeid): - """ Yield the list of next precursors pointing on visible changectx nodes - """ - - precursors = repo.obsstore.predecessors - stack = [nodeid] - seen = set(stack) - - while stack: - current = stack.pop() - currentpreccs = precursors.get(current, ()) - - for prec in currentpreccs: - precnodeid = prec[0] - - # Basic cycle protection - if precnodeid in seen: - continue - seen.add(precnodeid) - - if precnodeid in repo: - yield precnodeid - else: - stack.append(precnodeid) - - @eh.templatekw("precursors") - def shownextvisibleprecursors(repo, ctx, **args): - """Returns a string containing the list of the closest precursors - """ - precursors = sorted(closestprecursors(repo, ctx.node())) - precursors = [node.hex(p) for p in precursors] - - return templatekw._hybrid(None, precursors, lambda x: {'precursor': x}, - lambda d: d['precursor'][:12]) +templatekw.keywords["precursors"] = templatekw.showpredecessors def closestsuccessors(repo, nodeid): """ returns the closest visible successors sets instead.