hgext3rd/evolve/stablerange.py
changeset 2156 e57f28fafe41
parent 2155 89ce52e855ed
child 2159 9b052257c743
equal deleted inserted replaced
2155:89ce52e855ed 2156:e57f28fafe41
   355         return self._id
   355         return self._id
   356 
   356 
   357     def __eq__(self, other):
   357     def __eq__(self, other):
   358         if type(self) != type(other):
   358         if type(self) != type(other):
   359             raise NotImplementedError()
   359             raise NotImplementedError()
   360         return self.stablekey == other.stablekey
   360         return self._stablekey == other._stablekey
   361 
   361 
   362     def __getitem__(self, idx):
   362     def __getitem__(self, idx):
   363         """small helper function to prepare for the migration to tuple"""
   363         """small helper function to prepare for the migration to tuple"""
   364         if idx == 0:
   364         if idx == 0:
   365             return self._head
   365             return self._head
   368         else:
   368         else:
   369             raise IndexError(idx)
   369             raise IndexError(idx)
   370 
   370 
   371     @util.propertycache
   371     @util.propertycache
   372     def _id(self):
   372     def _id(self):
   373         return hash(self.stablekey)
   373         return hash(self._stablekey)
   374 
   374 
   375     @util.propertycache
   375     @util.propertycache
   376     def stablekey(self):
   376     def _stablekey(self):
   377         return (self[0], self.index)
   377         return (self[0], self.index)
   378 
   378 
   379     def __len__(self):
   379     def __len__(self):
   380         return self.depth - self.index
   380         return self.depth - self.index
   381 
   381