Mercurial > evolve
changeset 4255:7661706dc14d
compat: drop 4.3 compatiblity code for 'precursors' revset
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 19 Nov 2018 01:41:36 +0000 |
parents | 8e891b4a54e8 |
children | e7e154b2388b |
files | hgext3rd/evolve/templatekw.py |
diffstat | 1 files changed, 1 insertions(+), 38 deletions(-) [+] |
line wrap: on
line diff
--- 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.