Mercurial > hg
changeset 39167:136ed75bbe12
dagutil: remove descendantset() and ancestorset()
descendantset() is unused after the previous commit. And
ancestorset() was only used by descendantset(), so it can be removed
as well.
.. api:: descendantset() and ancestorset() removed from dagutil
Use a revset instead when operating on the changelog. Or use
various functionality in the ancestor or dagop modules.
Differential Revision: https://phab.mercurial-scm.org/D4315
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 17 Aug 2018 17:15:09 +0000 |
parents | 484c9fe570a7 |
children | 2d218db7389b |
files | mercurial/dagutil.py |
diffstat | 1 files changed, 0 insertions(+), 46 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dagutil.py Fri Aug 17 17:13:26 2018 +0000 +++ b/mercurial/dagutil.py Fri Aug 17 17:15:09 2018 +0000 @@ -36,18 +36,6 @@ '''inverse DAG, where parents becomes children, etc.''' raise NotImplementedError - def ancestorset(self, starts, stops=None): - ''' - set of all ancestors of starts (incl), but stop walk at stops (excl) - ''' - raise NotImplementedError - - def descendantset(self, starts, stops=None): - ''' - set of all descendants of starts (incl), but stop walk at stops (excl) - ''' - return self.inverse().ancestorset(starts, stops) - def headsetofconnecteds(self, ixs): ''' subset of connected list of ixs so that no node has a descendant in it @@ -60,20 +48,6 @@ class genericdag(basedag): '''generic implementations for DAGs''' - def ancestorset(self, starts, stops=None): - if stops: - stops = set(stops) - else: - stops = set() - seen = set() - pending = list(starts) - while pending: - n = pending.pop() - if n not in seen and n not in stops: - seen.add(n) - pending.extend(self.parents(n)) - return seen - def headsetofconnecteds(self, ixs): hds = set(ixs) if not hds: @@ -128,26 +102,6 @@ self._inverse = inverserevlogdag(self) return self._inverse - def ancestorset(self, starts, stops=None): - rlog = self._revlog - idx = rlog.index - if stops: - stops = set(stops) - else: - stops = set() - seen = set() - pending = list(starts) - while pending: - rev = pending.pop() - if rev not in seen and rev not in stops: - seen.add(rev) - revdata = idx[rev] - for i in [5, 6]: - prev = revdata[i] - if prev != nullrev: - pending.append(prev) - return seen - def headsetofconnecteds(self, ixs): if not ixs: return set()