Mercurial > evolve
changeset 2181:eea1fdeb1eb3
stablerange: drop "key" and "id" logic form the class
We can restrict to the bare minimun for equality and hashing now.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Wed, 22 Mar 2017 19:30:23 +0100 |
parents | 7570e0683460 |
children | 884f6309eae7 |
files | hgext3rd/evolve/stablerange.py |
diffstat | 1 files changed, 2 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/stablerange.py Wed Mar 22 19:28:14 2017 +0100 +++ b/hgext3rd/evolve/stablerange.py Wed Mar 22 19:30:23 2017 +0100 @@ -352,12 +352,12 @@ assert index < depth, (head, index, depth, revs) def __hash__(self): - return self._id + return hash((self._head, self._index)) def __eq__(self, other): if type(self) != type(other): raise NotImplementedError() - return self._stablekey == other._stablekey + return (self._head, self._index) == (other._head, other._index) def __getitem__(self, idx): """small helper function to prepare for the migration to tuple""" @@ -369,14 +369,6 @@ raise IndexError(idx) @util.propertycache - def _id(self): - return hash(self._stablekey) - - @util.propertycache - def _stablekey(self): - return (self[0], self[1]) - - @util.propertycache def _revs(self): length = self._repo.stablerange.rangelength(self._repo, self) r = stablesort(self._repo, [self[0]])[self[1]:]