Mercurial > evolve
changeset 2133:323480863248
stablerange: directly perform slicing in the getting method
Now that all necessary functions are available, we simply apply the standard
slicing on cache miss and proceed.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Sun, 19 Mar 2017 04:45:28 +0100 |
parents | d77262807411 |
children | b86b94434de7 |
files | hgext3rd/evolve/stablerange.py |
diffstat | 1 files changed, 6 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/stablerange.py Sun Mar 19 04:43:33 2017 +0100 +++ b/hgext3rd/evolve/stablerange.py Sun Mar 19 04:45:28 2017 +0100 @@ -227,9 +227,11 @@ return cached if self.rangelength(repo, rangeid) == 1: value = [] - self._subrangescache[rangeid] = value - return value - return None + else: + slicepoint = self._slicepoint(repo, rangeid) + value = self._slicesrangeat(repo, rangeid, slicepoint) + self._subrangescache[rangeid] = value + return value def setsubranges(self, rangeid, value): # XXX temporary cache setter as value computation are performed outside @@ -341,14 +343,7 @@ return r def subranges(self): - cache = self._repo.stablerange - cached = cache.subranges(self._repo, self) - if cached is not None: - return cached - slicepoint = cache._slicepoint(self._repo, self) - result = cache._slicesrangeat(self._repo, self, slicepoint) - self._repo.stablerange.setsubranges(self, result) - return result + return self._repo.stablerange.subranges(self._repo, self) @util.propertycache def obshash(self):