# HG changeset patch # User Pierre-Yves David # Date 1730718779 -3600 # Node ID 7fcf18ea78130724823785a18af4b20ec304ae81 # Parent 2efcacc03010beeb11369c703b8038b9b01d78a1 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. diff -r 2efcacc03010 -r 7fcf18ea7813 hgext3rd/evolve/obsdiscovery.py --- 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')