obshistory: use successorsandmarkers() from obsutil, drop local variant
authorAnton Shestakov <av6@dwimlabs.net>
Thu, 02 Jan 2020 01:16:18 +0700
changeset 5056 456129fdcf93
parent 5055 5187cb1fd905
child 5057 da5cc4e493ff
obshistory: use successorsandmarkers() from obsutil, drop local variant It's been in core since 4.4 and is identical to the version removed by this patch, except it returns None if ctx is not obsolete.
hgext3rd/evolve/obshistory.py
--- a/hgext3rd/evolve/obshistory.py	Tue Dec 31 21:41:22 2019 +0700
+++ b/hgext3rd/evolve/obshistory.py	Thu Jan 02 01:16:18 2020 +0700
@@ -99,50 +99,6 @@
     revs.reverse()
     _debugobshistoryrevs(ui, repo, revs, opts)
 
-def _successorsandmarkers(repo, ctx):
-    """compute the raw data needed for computing obsfate
-    Returns a list of dict, one dict per successors set
-    """
-    ssets = obsutil.successorssets(repo, ctx.node(), closest=True)
-
-    # closestsuccessors returns an empty list for pruned revisions, remap it
-    # into a list containing an empty list for future processing
-    if ssets == []:
-        ssets = [[]]
-
-    # Try to recover pruned markers
-    succsmap = repo.obsstore.successors
-    fullsuccessorsets = [] # successor set + markers
-    for sset in ssets:
-        if sset:
-            fullsuccessorsets.append(sset)
-        else:
-            # successorsset return an empty set() when ctx or one of its
-            # successors is pruned.
-            # In this case, walk the obs-markers tree again starting with ctx
-            # and find the relevant pruning obs-makers, the ones without
-            # successors.
-            # Having these markers allow us to compute some information about
-            # its fate, like who pruned this changeset and when.
-
-            # XXX we do not catch all prune markers (eg rewritten then pruned)
-            # (fix me later)
-            foundany = False
-            for mark in succsmap.get(ctx.node(), ()):
-                if not mark[1]:
-                    foundany = True
-                    sset = obsutil._succs()
-                    sset.markers.add(mark)
-                    fullsuccessorsets.append(sset)
-            if not foundany:
-                fullsuccessorsets.append(obsutil._succs())
-
-    values = []
-    for sset in fullsuccessorsets:
-        values.append({b'successors': sset, b'markers': sset.markers})
-
-    return values
-
 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")}""" % {
@@ -220,7 +176,9 @@
                                                   self._includediff)
 
             else:
-                r = _successorsandmarkers(self.repo, ctx)
+                r = obsutil.successorsandmarkers(self.repo, ctx)
+                if r is None:
+                    r = []
 
                 for succset in sorted(r):
                     markers = succset[b"markers"]