Read about our upcoming Code of Conduct on this issue

This instance will be upgraded to Heptapod 0.28.0 on 2022-01-18 at 14:00 UTC+1 (a few minutes of down time)

Commit c382d8ba authored by Pierre-Yves David's avatar Pierre-Yves David 🐙
Browse files

compat: drop 4.3 compatiblity code for 'precursors' revset

parent 8e891b4a54e8
......@@ -41,44 +41,7 @@ else:
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.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment