Mercurial > evolve
changeset 6933:7fcf18ea7813 stable
obshashrange: reset the cache if too many ranges need to be deleted
If some old revision gets affected, we might need to reset so many ranges that
resetting the full cache might be faster.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 04 Nov 2024 12:12:59 +0100 |
parents | 2efcacc03010 |
children | dd518437d4e0 |
files | hgext3rd/evolve/obsdiscovery.py |
diffstat | 1 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/obsdiscovery.py Mon Nov 04 12:07:33 2024 +0100 +++ b/hgext3rd/evolve/obsdiscovery.py Mon Nov 04 12:12:59 2024 +0100 @@ -327,8 +327,10 @@ for i in range(0, len(items), size): yield items[i:i + size] -# if there is that many new obsmarkers, reset without analysing them +# reset when there are this many new obsmarkers or affected changesets RESET_ABOVE = 10000 +# reset when there are this many affected ranges +RESET_ABOVE_RANGES = RESET_ABOVE * 10 class _obshashcache(obscache.dualsourcecache): @@ -436,6 +438,14 @@ # always reset for now, the code detecting affect is buggy # so we need to reset more broadly than we would like. try: + if reset: + ranges = [] # no need to compute that + else: + ranges = repo.stablerange.contains(repo, affected) + if RESET_ABOVE_RANGES < len(ranges): + repo.ui.log(b'evoext-cache', b'obshashcache reset - ' + b'too many ranges to purges\n') + reset = True if repo.stablerange._con is None: repo.ui.log(b'evoext-cache', b'obshashcache reset - ' b'underlying stablerange cache unavailable\n')