stablerange: stop using '.index' inside the class itself
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Wed, 22 Mar 2017 17:57:04 +0100
changeset 2162 7967d0b86364
parent 2161 0a06f5cbca4b
child 2163 e2dc8c4897be
stablerange: stop using '.index' inside the class itself We now access '[1]' as we'll do with the future tuple.
hgext3rd/evolve/stablerange.py
--- a/hgext3rd/evolve/stablerange.py	Wed Mar 22 17:55:57 2017 +0100
+++ b/hgext3rd/evolve/stablerange.py	Wed Mar 22 17:57:04 2017 +0100
@@ -349,7 +349,7 @@
 
     def __repr__(self):
         nodehead = self._repo.changelog.node(self[0])
-        return '%s %d %d %s' % (nodemod.short(nodehead), self.depth, self.index, nodemod.short(self.obshash))
+        return '%s %d %d %s' % (nodemod.short(nodehead), self.depth, self[1], nodemod.short(self.obshash))
 
     def __hash__(self):
         return self._id
@@ -374,10 +374,10 @@
 
     @util.propertycache
     def _stablekey(self):
-        return (self[0], self.index)
+        return (self[0], self[1])
 
     def __len__(self):
-        return self.depth - self.index
+        return self.depth - self[1]
 
     @util.propertycache
     def depth(self):
@@ -385,8 +385,8 @@
 
     @util.propertycache
     def _revs(self):
-        r = stablesort(self._repo, [self[0]])[self.index:]
-        assert len(r) == len(self), (self[0], self.index, len(r), len(self))
+        r = stablesort(self._repo, [self[0]])[self[1]:]
+        assert len(r) == len(self), (self[0], self[1], len(r), len(self))
         return r
 
     def subranges(self):