stablerange: use rangelength inside the class itself
We stop using the building '__len__' this get use closer to be able to use a
tuple.
--- a/hgext3rd/evolve/stablerange.py Wed Mar 22 18:40:54 2017 +0100
+++ b/hgext3rd/evolve/stablerange.py Wed Mar 22 18:41:26 2017 +0100
@@ -343,7 +343,7 @@
self._head = head
self._index = index
if revs is not None:
- assert len(revs) == len(self)
+ assert len(revs) == self._len()
self._revs = revs
assert index < self.depth, (head, index, self.depth, revs)
@@ -376,8 +376,8 @@
def _stablekey(self):
return (self[0], self[1])
- def __len__(self):
- return self.depth - self[1]
+ def _len(self):
+ return self._repo.stablerange.rangelength(self._repo, self)
@util.propertycache
def depth(self):
@@ -386,7 +386,7 @@
@util.propertycache
def _revs(self):
r = stablesort(self._repo, [self[0]])[self[1]:]
- assert len(r) == len(self), (self[0], self[1], len(r), len(self))
+ assert len(r) == self._len(), (self[0], self[1], len(r), self._len())
return r
def subranges(self):