--- a/hgext3rd/evolve/obshistory.py Fri Apr 24 01:09:30 2020 +0800
+++ b/hgext3rd/evolve/obshistory.py Fri Apr 24 01:14:34 2020 +0800
@@ -160,6 +160,34 @@
groupmarkers.update(markers)
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:
+ continue
+ seen.add(prednode)
+
+ if prednode in repo:
+ yield ((prednode,), path + (marker,))
+ else:
+ stack.append((prednode, path + (marker,)))
+
def _nodesandmarkers(repo, ctx, filternonlocal):
if filternonlocal:
r = obsutil.successorsandmarkers(repo, ctx)