comparison mercurial/phases.py @ 18983:31bcc5112191

destroyed: invalidate phraserevs cache in all case (issue3858) When revisions are destroyed, the `phaserevs` cache becomes invalid in most case. This cache hold a `{rev => phase}` mapping and revision number most likely changed. Since 1c8e0d6ac3b0, we filter unknown phases' roots after changesets destruction. When some roots are filtered the `phaserevs` cache is invalidated. But not if none root where destroyed. We now invalidate the cache in all case filtered root or not. This bug was a bit tricky to reproduce as in most case we either: * rebase a set a draft changeset including root (phaserev invalidated) * strip tip-most changesets (no re-numbering of revision) Note that the invalidation of `phaserevs` are not strictly needed when only tip-most part of the history have been destroyed. But I do not expect the overhead to be significant.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Mon, 15 Apr 2013 17:10:58 +0200
parents 767d1c602c8b
children d51c4d85ec23
comparison
equal deleted inserted replaced
18982:43cb150e74f9 18983:31bcc5112191
264 % (short(mnode), phase)) 264 % (short(mnode), phase))
265 nodes.symmetric_difference_update(missing) 265 nodes.symmetric_difference_update(missing)
266 filtered = True 266 filtered = True
267 if filtered: 267 if filtered:
268 self.dirty = True 268 self.dirty = True
269 self._phaserevs = None 269 # filterunknown is called by repo.destroyed, we may have no changes in
270 # root but phaserevs contents is certainly invalide (or at least we
271 # have not proper way to check that. related to issue 3858.
272 #
273 # The other caller is __init__ that have no _phaserevs initialized
274 # anyway. If this change we should consider adding a dedicated
275 # "destroyed" function to phasecache or a proper cache key mechanisme
276 # (see branchmap one)
277 self._phaserevs = None
270 278
271 def advanceboundary(repo, targetphase, nodes): 279 def advanceboundary(repo, targetphase, nodes):
272 """Add nodes to a phase changing other nodes phases if necessary. 280 """Add nodes to a phase changing other nodes phases if necessary.
273 281
274 This function move boundary *forward* this means that all nodes 282 This function move boundary *forward* this means that all nodes