changeset 5325:1208f8275b8b

templatekw: remove unused closestsuccessors() and directsuccessorssets() Usage of these functions was dropped in 901186e1fe05 and e7e154b2388b.
author Anton Shestakov <av6@dwimlabs.net>
date Sat, 16 May 2020 15:48:52 +0800
parents 7295f3fa8e83
children a9a08b3d50fb
files hgext3rd/evolve/templatekw.py
diffstat 1 files changed, 0 insertions(+), 94 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/templatekw.py	Mon Dec 30 00:11:00 2019 +0530
+++ b/hgext3rd/evolve/templatekw.py	Sat May 16 15:48:52 2020 +0800
@@ -60,12 +60,6 @@
 else:
     templatekw.keywords[b"precursors"] = _sp
 
-
-def closestsuccessors(repo, nodeid):
-    """ returns the closest visible successors sets instead.
-    """
-    return directsuccessorssets(repo, nodeid)
-
 _ss = templatekw.showsuccessorssets
 if util.safehasattr(_ss, '_requires'):
     def showsuccessors(context, mapping):
@@ -82,91 +76,3 @@
         return ui.username()
     except error.Abort: # no easy way to avoid ui raising Abort here :-/
         return None
-
-# copy from mercurial.obsolete with a small change to stop at first known changeset.
-
-def directsuccessorssets(repo, initialnode, cache=None):
-    """return set of all direct successors of initial nodes
-    """
-
-    succmarkers = repo.obsstore.successors
-
-    # Stack of nodes we search successors sets for
-    toproceed = [initialnode]
-    # set version of above list for fast loop detection
-    # element added to "toproceed" must be added here
-    stackedset = set(toproceed)
-
-    pathscache = {}
-
-    if cache is None:
-        cache = {}
-    while toproceed:
-        current = toproceed[-1]
-        if current in cache:
-            stackedset.remove(toproceed.pop())
-        elif current != initialnode and current in repo:
-            # We have a valid direct successors.
-            cache[current] = [(current,)]
-        elif current not in succmarkers:
-            if current in repo:
-                # We have a valid last successors.
-                cache[current] = [(current,)]
-            else:
-                # Final obsolete version is unknown locally.
-                # Do not count that as a valid successors
-                cache[current] = []
-        else:
-            for mark in sorted(succmarkers[current]):
-                for suc in mark[1]:
-                    if suc not in cache:
-                        if suc in stackedset:
-                            # cycle breaking
-                            cache[suc] = []
-                        else:
-                            # case (3) If we have not computed successors sets
-                            # of one of those successors we add it to the
-                            # `toproceed` stack and stop all work for this
-                            # iteration.
-                            pathscache.setdefault(suc, []).append((current, mark))
-                            toproceed.append(suc)
-                            stackedset.add(suc)
-                            break
-                else:
-                    continue
-                break
-            else:
-                succssets = []
-                for mark in sorted(succmarkers[current]):
-                    # successors sets contributed by this marker
-                    markss = [[]]
-                    for suc in mark[1]:
-                        # cardinal product with previous successors
-                        productresult = []
-                        for prefix in markss:
-                            for suffix in cache[suc]:
-                                newss = list(prefix)
-                                for part in suffix:
-                                    # do not duplicated entry in successors set
-                                    # first entry wins.
-                                    if part not in newss:
-                                        newss.append(part)
-                                productresult.append(newss)
-                        markss = productresult
-                    succssets.extend(markss)
-                # remove duplicated and subset
-                seen = []
-                final = []
-                candidate = sorted(((set(s), s) for s in succssets if s),
-                                   key=lambda x: len(x[1]), reverse=True)
-                for setversion, listversion in candidate:
-                    for seenset in seen:
-                        if setversion.issubset(seenset):
-                            break
-                    else:
-                        final.append(listversion)
-                        seen.append(setversion)
-                final.reverse() # put small successors set first
-                cache[current] = final
-
-    return cache[initialnode], pathscache