stablerange: stop using '.head' inside the class
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Wed, 22 Mar 2017 17:45:39 +0100
changeset 2154 f02f63c26424
parent 2153 7c5149a129d2
child 2155 89ce52e855ed
stablerange: stop using '.head' inside the class We now access '[0]' as we'll do with the future tuple.
hgext3rd/evolve/stablerange.py
--- a/hgext3rd/evolve/stablerange.py	Wed Mar 22 17:45:21 2017 +0100
+++ b/hgext3rd/evolve/stablerange.py	Wed Mar 22 17:45:39 2017 +0100
@@ -348,7 +348,7 @@
         assert index < self.depth, (head, index, self.depth, revs)
 
     def __repr__(self):
-        nodehead = self._repo.changelog.node(self.head)
+        nodehead = self._repo.changelog.node(self[0])
         return '%s %d %d %s' % (nodemod.short(nodehead), self.depth, self.index, nodemod.short(self.obshash))
 
     def __hash__(self):
@@ -374,19 +374,19 @@
 
     @util.propertycache
     def stablekey(self):
-        return (self.head, self.index)
+        return (self[0], self.index)
 
     def __len__(self):
         return self.depth - self.index
 
     @util.propertycache
     def depth(self):
-        return self._repo.stablerange.depthrev(self._repo, self.head)
+        return self._repo.stablerange.depthrev(self._repo, self[0])
 
     @util.propertycache
     def _revs(self):
-        r = stablesort(self._repo, [self.head])[self.index:]
-        assert len(r) == len(self), (self.head, self.index, len(r), len(self))
+        r = stablesort(self._repo, [self[0]])[self.index:]
+        assert len(r) == len(self), (self[0], self.index, len(r), len(self))
         return r
 
     def subranges(self):