577 result.append(entry) |
577 result.append(entry) |
578 result.append(_range(self._repo, self.head, globalindex, top)) |
578 result.append(_range(self._repo, self.head, globalindex, top)) |
579 return result |
579 return result |
580 |
580 |
581 def subranges(self): |
581 def subranges(self): |
|
582 if not util.safehasattr(self._repo, '_subrangecache'): |
|
583 self._repo._subrangecache = {} |
|
584 cached = self._repo._subrangecache.get(self) |
|
585 if cached is not None: |
|
586 return cached |
582 if len(self) == 1: |
587 if len(self) == 1: |
583 return [] |
588 return [] |
584 step = _hlp2(self.depth) |
589 step = _hlp2(self.depth) |
585 standard_start = 0 |
590 standard_start = 0 |
586 while standard_start < self.index and 0 < step: |
591 while standard_start < self.index and 0 < step: |
587 if standard_start + step < self.depth: |
592 if standard_start + step < self.depth: |
588 standard_start += step |
593 standard_start += step |
589 step //= 2 |
594 step //= 2 |
590 if self.index == standard_start: |
595 if self.index == standard_start: |
591 slicesize = _hlp2(len(self)) |
596 slicesize = _hlp2(len(self)) |
592 return self._slicesat(self.index + slicesize) |
597 slicepoint = self.index + slicesize |
593 else: |
598 else: |
594 assert standard_start < self.depth |
599 assert standard_start < self.depth |
595 return self._slicesat(standard_start) |
600 slicepoint = standard_start |
|
601 result = self._slicesat(slicepoint) |
|
602 self._repo._subrangecache[self] = result |
|
603 return result |
596 |
604 |
597 @util.propertycache |
605 @util.propertycache |
598 def obshash(self): |
606 def obshash(self): |
599 cache = self._repo.obsstore.rangeobshashcache |
607 cache = self._repo.obsstore.rangeobshashcache |
600 cl = self._repo.changelog |
608 cl = self._repo.changelog |