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.
--- 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):