obshistory: implement predecessorsandmarkers() for obsorigin draft
authorAnton Shestakov <av6@dwimlabs.net>
Tue, 14 Jan 2020 20:58:26 +0700
changeset 5254 78bdd1fabe25
parent 5124 22548cdeb2b0
child 5255 939ff6ea1e7d
obshistory: implement predecessorsandmarkers() for obsorigin
hgext3rd/evolve/obshistory.py
--- a/hgext3rd/evolve/obshistory.py	Tue Feb 04 14:07:29 2020 +0700
+++ b/hgext3rd/evolve/obshistory.py	Tue Jan 14 20:58:26 2020 +0700
@@ -103,6 +103,15 @@
     revs.reverse()
     _debugobshistoryrevs(ui, repo, revs, opts)
 
+def predecessorsandmarkers(repo, ctx):
+    """ Compute raw data that is needed for obsorigin.
+    """
+    predecessors = repo.obsstore.predecessors
+    prednodes = [marker[0] for marker in predecessors.get(ctx.node(), ())]
+    obsmarkers = obsutil.getmarkers(repo, [ctx.node()] + prednodes)
+    rawmarkers = set(marker._data for marker in obsmarkers)
+    return [{b'predecessors': prednodes, b'markers': rawmarkers}]
+
 TEMPLATE_MISSING_NODE = b"""{label("evolve.node evolve.missing_change_ctx", node|short)}"""
 TEMPLATE_PRESENT_NODE = b"""{label("evolve.node", node|short)} {label("evolve.rev", "({rev})")} {label("evolve.short_description", desc|firstline)}"""
 TEMPLATE_FIRST_LINE = b"""{if(rev, "%(presentnode)s", "%(missingnode)s")}""" % {