Mercurial > hg
changeset 39175:bbb855c412c6
dagutil: remove ability to invert instances
The previous commit removed the last consumer of this feature.
.. api:: remove inverse() methods from classes in dagutil
Differential Revision: https://phab.mercurial-scm.org/D4323
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 17 Aug 2018 19:12:25 +0000 |
parents | 71d83b315778 |
children | fec01c69b0f0 |
files | mercurial/dagutil.py |
diffstat | 1 files changed, 0 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dagutil.py Fri Aug 17 18:22:10 2018 +0000 +++ b/mercurial/dagutil.py Fri Aug 17 19:12:25 2018 +0000 @@ -21,17 +21,10 @@ Pluralized params are lists or sets. ''' - def __init__(self): - self._inverse = None - def parents(self, ix): '''list of parents ixs of ix''' raise NotImplementedError - def inverse(self): - '''inverse DAG, where parents becomes children, etc.''' - raise NotImplementedError - def headsetofconnecteds(self, ixs): ''' subset of connected list of ixs so that no node has a descendant in it @@ -83,11 +76,6 @@ return [prev2] return [] - def inverse(self): - if self._inverse is None: - self._inverse = inverserevlogdag(self) - return self._inverse - def headsetofconnecteds(self, ixs): if not ixs: return set() @@ -130,41 +118,3 @@ if p in ixs and p not in finished] assert len(sorted) == len(ixs) return sorted - - -class inverserevlogdag(revlogbaseddag, genericdag): - '''inverse of an existing revlog dag; see revlogdag.inverse()''' - - def __init__(self, orig): - revlogbaseddag.__init__(self, orig._revlog) - self._orig = orig - self._children = {} - self._roots = [] - self._walkfrom = len(self._revlog) - 1 - - def _walkto(self, walkto): - rev = self._walkfrom - cs = self._children - roots = self._roots - idx = self._revlog.index - while rev >= walkto: - data = idx[rev] - isroot = True - for prev in [data[5], data[6]]: # parent revs - if prev != nullrev: - cs.setdefault(prev, []).append(rev) - isroot = False - if isroot: - roots.append(rev) - rev -= 1 - self._walkfrom = rev - - def parents(self, ix): - if ix is None: - return [] - if ix <= self._walkfrom: - self._walkto(ix) - return self._children.get(ix, []) - - def inverse(self): - return self._orig