# HG changeset patch # User Pierre-Yves David # Date 1489895128 -3600 # Node ID 323480863248a07a708efe21244f8765b01f673e # Parent d7726280741149f622d64985e5aabdfaee36c97a 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. diff -r d77262807411 -r 323480863248 hgext3rd/evolve/stablerange.py --- 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):