--- a/hgext3rd/evolve/stablerange.py Fri Mar 24 06:31:32 2017 +0100
+++ b/hgext3rd/evolve/stablerange.py Thu Mar 23 14:17:15 2017 +0100
@@ -170,15 +170,6 @@
# something useful to compute the above
# mergerev -> stablesort, length
self._stablesortprepared = {}
- # if we already know all the revision that belong to a range, it is
- # quite trivial to have the subrange "inherit" that knowledge. This
- # cache is dedicated to hold the full list of revs inside a subrange
- # when we happens to know it.
- #
- # For example. if we are slicing a range headed by a merge so will have
- # the revision computed anyway, and passing that knowledge around might
- # help to slice one of its subranges also containings a merge.
- self._revsinrangecache = {}
# caching parent call # as we do so many of them
self._parentscache = {}
@@ -235,28 +226,25 @@
return value
def revsfromrange(self, repo, rangeid):
- revs = self._revsinrangecache.get(rangeid)
headrev, index = rangeid
rangelength = self.rangelength(repo, rangeid)
- if revs is None:
- if rangelength == 1:
- revs = [headrev]
- else:
- # get all revs under heads in stable order
- #
- # note: In the general case we can just walk down and then request
- # data about the merge. But I'm not sure this function will be even
- # call for the general case.
- allrevs = self._stablesortcache.get(headrev)
+ if rangelength == 1:
+ revs = [headrev]
+ else:
+ # get all revs under heads in stable order
+ #
+ # note: In the general case we can just walk down and then request
+ # data about the merge. But I'm not sure this function will be even
+ # call for the general case.
+ allrevs = self._stablesortcache.get(headrev)
+ if allrevs is None:
+ allrevs = self._getrevsfrommerge(repo, headrev)
if allrevs is None:
- allrevs = self._getrevsfrommerge(repo, headrev)
- if allrevs is None:
- allrevs = stablesort(repo, [headrev],
- mergecallback=self._filestablesortcache)
- self._stablesortcache[headrev] = allrevs
- # takes from index
- revs = allrevs[index:]
- self._revsinrangecache[rangeid] = revs
+ allrevs = stablesort(repo, [headrev],
+ mergecallback=self._filestablesortcache)
+ self._stablesortcache[headrev] = allrevs
+ # takes from index
+ revs = allrevs[index:]
# sanity checks
assert len(revs) == rangelength
return revs
@@ -374,10 +362,6 @@
return None
parentrange = (p1, rangeid[1])
# if we have an entry for the current range, lets update the cache
- revscache = self._revsinrangecache
- if rangeid in revscache and parentrange not in revscache:
- parentrevs = self._revsinrangecache[rangeid][:-1]
- self._revsinrangecache[parentrange] = parentrevs
# if we already have subrange for this range, no need to prepare it.
if self._subrangescache.get(parentrange) is not None:
return None
@@ -412,9 +396,6 @@
topsize = rangedepth - globalindex
parentrange = (p1, rangeid[1])
- if rangeid in self._revsinrangecache:
- # revs cache should have been filled by _unpreparedparentrange
- assert parentrange in self._revsinrangecache
if topsize == 1:
top = (rangeid[0], globalindex)
@@ -427,10 +408,6 @@
parentsubranges = self.subranges(repo, parentrange)
slices = parentsubranges[:-1] # pop the top
top = (rangeid[0], globalindex)
- # if we have an entry for the current range, lets update the cache
- if rangeid in self._revsinrangecache:
- parentrevs = self._revsinrangecache[rangeid][-topsize:]
- self._revsinrangecache[top] = parentrevs
slices.append(top)
return slices
@@ -440,10 +417,8 @@
result = []
allrevs = self.revsfromrange(repo, rangeid)
- toprevs = allrevs[localindex:]
bottomrevs = allrevs[:localindex]
top = (rangeid[0], globalindex)
- self._revsinrangecache[top] = toprevs # update cache
#
rangedepth = self.depthrev(repo, rangeid[0])
maxbottomdepth = self.depthrev(repo, bottomrevs[-1])
@@ -463,7 +438,6 @@
bottomdepth = self.depthrev(repo, newhead)
newstart = bottomdepth - len(bottomrevs)
bottom = (newhead, newstart)
- self._revsinrangecache[bottom] = bottomrevs # update cache
result.append(bottom)
else:
# assert 1 < len(bheads), (toprootdepth, len(top), len(rangeid))
@@ -473,7 +447,6 @@
hrevs = [r for r in bottomrevs if r in subset]
start = self.depthrev(repo, h) - len(hrevs)
entry = (h, start)
- self._revsinrangecache[entry] = hrevs # update cache
result.append(entry)
result.append(top)
return result