Mercurial > evolve
changeset 3333:96d1cf475c19
stablerange: use first merge cache to skip over linear section
If we are to skip over a large section of the range, skipping everything until
the first merge seems like a good idea.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 18 Dec 2017 20:04:50 +0100 |
parents | 7d4c157b6519 |
children | db8feb404792 |
files | hgext3rd/evolve/stablerange.py |
diffstat | 1 files changed, 11 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/stablerange.py Wed Dec 20 20:46:10 2017 +0100 +++ b/hgext3rd/evolve/stablerange.py Mon Dec 18 20:04:50 2017 +0100 @@ -449,6 +449,7 @@ """Compute subrange unique to the exclusive part of merge""" result = [] depth = repo.depthcache.get + nextmerge = repo.firstmergecache.get walkfrom = functools.partial(self._sortcache.walkfrom, repo) getjumps = functools.partial(self._sortcache.getjumps, repo) skips = depth(headrev) - slicepoint @@ -464,12 +465,15 @@ # utility function to find the next changeset with jump information # (and the distance to it) - def nextmerge(startrev): - for idx, rev in enumerate(walkfrom(startrev)): - if getjumps(rev) is not None: - return idx, rev - idx += 1 - return idx, None + def nextmergedata(startrev): + merge = nextmerge(startrev) + depthrev = depth(startrev) + if merge == startrev: + return 0, startrev + elif merge == nodemod.nullrev: + return depthrev, None + depthmerge = depth(merge) + return depthrev - depthmerge, merge # skip over all necesary data mainjump = None @@ -510,7 +514,7 @@ while size < tomap: assert mainjump is not None if refjumps is None: - dist2merge, merge = nextmerge(jumphead) + dist2merge, merge = nextmergedata(jumphead) if (mainsize <= dist2merge) or merge is None: refjumps = iter(()) ref = None