Mercurial > evolve
changeset 3325:83d2a2f3dc8f
stablesort: use a regular dict for jumps
This will help knowing what revision we have already queried or not.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 10 Dec 2017 03:39:56 +0100 |
parents | 6ba8eaffe8f6 |
children | 8ebd31af1452 |
files | hgext3rd/evolve/stablesort.py |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/stablesort.py Wed Dec 20 15:51:05 2017 +0100 +++ b/hgext3rd/evolve/stablesort.py Sun Dec 10 03:39:56 2017 +0100 @@ -318,7 +318,7 @@ class stablesortcache(object): def __init__(self): - self._jumps = collections.defaultdict(lambda: None) + self._jumps = {} def get(self, repo, rev, limit=None): result = [] @@ -330,9 +330,11 @@ return result def getjumps(self, repo, rev): - if self._jumps[rev] is None: + 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: + self._jumps[rev] = None return self._jumps[rev] def walkfrom(self, repo, head): @@ -366,7 +368,7 @@ previous_current_1 = current assert previous_current_1 is not previous_current_2 - jumps = self._jumps[current] + jumps = self._jumps.get(current) if jumps is not None: # we have enough cached information to directly iterate over # the exclusive size.