comparison mercurial/branchmap.py @ 51489:659f766629c8

branchcache: stop using `copy(…)` in `replace(…)` The `copy` method is mostly used for a filter level to inherit the branchmap from a subset. So we stop using (abusing) it in "replace" to ensure `copy` is used only for inheritance purposes. Since `replace` is a method of the BranchMapCache, it seems fine to do lower level operation there.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 09 Mar 2024 02:07:15 +0100
parents 94f821490645
children 18c2753434f2
comparison
equal deleted inserted replaced
51488:94f821490645 51489:659f766629c8
155 # Try to stick it as low as possible 155 # Try to stick it as low as possible
156 # filter above served are unlikely to be fetch from a clone 156 # filter above served are unlikely to be fetch from a clone
157 for candidate in (b'base', b'immutable', b'served'): 157 for candidate in (b'base', b'immutable', b'served'):
158 rview = repo.filtered(candidate) 158 rview = repo.filtered(candidate)
159 if cache.validfor(rview): 159 if cache.validfor(rview):
160 cache = self._per_filter[candidate] = cache.copy(rview) 160 cache._filtername = candidate
161 self._per_filter[candidate] = cache
162 cache._dirty = True
161 cache.write(rview) 163 cache.write(rview)
162 return 164 return
163 165
164 def clear(self): 166 def clear(self):
165 self._per_filter.clear() 167 self._per_filter.clear()