Mercurial > hg
comparison mercurial/dagutil.py @ 39172:8973fc62bfff
dagutil: remove heads() and localsubset from revlogdag.__init__
The previous commit removed the last consumer of this API.
I'm not going to mark as API incompatible because I doubt anybody
used this functionality (outside of possibly passing an argument
to revlogdag.__init__). I intend to remove revlogdag later in
this series and its API annotation will cover this one.
Differential Revision: https://phab.mercurial-scm.org/D4320
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 17 Aug 2018 17:59:16 +0000 |
parents | 136ed75bbe12 |
children | bbb855c412c6 |
comparison
equal
deleted
inserted
replaced
39171:abce899c985f | 39172:8973fc62bfff |
---|---|
21 Pluralized params are lists or sets. | 21 Pluralized params are lists or sets. |
22 ''' | 22 ''' |
23 | 23 |
24 def __init__(self): | 24 def __init__(self): |
25 self._inverse = None | 25 self._inverse = None |
26 | |
27 def heads(self): | |
28 '''list of head ixs''' | |
29 raise NotImplementedError | |
30 | 26 |
31 def parents(self, ix): | 27 def parents(self, ix): |
32 '''list of parents ixs of ix''' | 28 '''list of parents ixs of ix''' |
33 raise NotImplementedError | 29 raise NotImplementedError |
34 | 30 |
63 '''generic dag interface to a revlog''' | 59 '''generic dag interface to a revlog''' |
64 | 60 |
65 def __init__(self, revlog): | 61 def __init__(self, revlog): |
66 basedag.__init__(self) | 62 basedag.__init__(self) |
67 self._revlog = revlog | 63 self._revlog = revlog |
68 self._heads = None | |
69 | |
70 def heads(self): | |
71 if self._heads is None: | |
72 self._heads = self._getheads() | |
73 return self._heads | |
74 | 64 |
75 class revlogdag(revlogbaseddag): | 65 class revlogdag(revlogbaseddag): |
76 '''dag interface to a revlog''' | 66 '''dag interface to a revlog''' |
77 | 67 |
78 def __init__(self, revlog, localsubset=None): | 68 def __init__(self, revlog): |
79 revlogbaseddag.__init__(self, revlog) | 69 revlogbaseddag.__init__(self, revlog) |
80 self._heads = localsubset | |
81 | |
82 def _getheads(self): | |
83 return [r for r in self._revlog.headrevs() if r != nullrev] | |
84 | 70 |
85 def parents(self, ix): | 71 def parents(self, ix): |
86 rlog = self._revlog | 72 rlog = self._revlog |
87 idx = rlog.index | 73 idx = rlog.index |
88 revdata = idx[ix] | 74 revdata = idx[ix] |
171 if isroot: | 157 if isroot: |
172 roots.append(rev) | 158 roots.append(rev) |
173 rev -= 1 | 159 rev -= 1 |
174 self._walkfrom = rev | 160 self._walkfrom = rev |
175 | 161 |
176 def _getheads(self): | |
177 self._walkto(nullrev) | |
178 return self._roots | |
179 | |
180 def parents(self, ix): | 162 def parents(self, ix): |
181 if ix is None: | 163 if ix is None: |
182 return [] | 164 return [] |
183 if ix <= self._walkfrom: | 165 if ix <= self._walkfrom: |
184 self._walkto(ix) | 166 self._walkto(ix) |