Mercurial > evolve
changeset 3326:8ebd31af1452
stablesort: warm jump cache more efficiently
We no longer for a full depth iteration for all request:
- we exit early for non-merge,
- for merge, we only iterate over the exclusive area.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 10 Dec 2017 03:49:48 +0100 |
parents | 83d2a2f3dc8f |
children | 0abc8fb7f49f |
files | hgext3rd/evolve/stablesort.py |
diffstat | 1 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/stablesort.py Sun Dec 10 03:39:56 2017 +0100 +++ b/hgext3rd/evolve/stablesort.py Sun Dec 10 03:49:48 2017 +0100 @@ -331,10 +331,16 @@ def getjumps(self, repo, rev): if rev not in self._jumps: - # still won't load anything if rev is not a merge - self.get(repo, rev) # we can be smarter here - if rev not in self._jumps: + parents = repo.changelog.parentrevs(rev) + if parents[1] == nodemod.nullrev: self._jumps[rev] = None + else: + # merge ! warn the cache + tiebreaker = _mergepoint_tie_breaker(repo) + minparent = sorted(parents, key=tiebreaker)[0] + for r in self.walkfrom(repo, rev): + if r == minparent: + break return self._jumps[rev] def walkfrom(self, repo, head):