Commit 0dc4c165 authored by Anton Shestakov's avatar Anton Shestakov
Browse files

obshistory: add predecessorsandmarkers()

parent a81631766575
Pipeline #5567 passed with stage
in 5 minutes and 18 seconds
......@@ -160,6 +160,34 @@
yield (tuple(sorted(groupnodes)), tuple(sorted(groupmarkers)))
def predecessorsandmarkers(repo, node):
""" Compute data needed for obsorigin.
Return a generator of (nodes, markers) tuples, where nodes is a tuple of
predecessor nodes and markers is a tuple of obsolescence markers.
Using tuples for everything means no problems with sorted().
predecessors = repo.obsstore.predecessors
stack = [(node, ())]
seen = {node}
while stack:
node, path = stack.pop()
for marker in sorted(predecessors.get(node, ())):
prednode = marker[0]
# Basic cycle protection
if prednode in seen:
if prednode in repo:
yield ((prednode,), path + (marker,))
stack.append((prednode, path + (marker,)))
def _nodesandmarkers(repo, ctx, filternonlocal):
if filternonlocal:
r = obsutil.successorsandmarkers(repo, ctx)
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