comparison mercurial/localrepo.py @ 18395:904b7109938e

destroyed: drop complex branchcache rebuilt logic The strip code used a trick to lower the cost of branchcache update after a strip. However is less necessary since we have branchcache collaboration. Invalid branchcache are likely to be cheaply rebuilt again a near subset of the repo. Moreover, this trick would need update to be relevant in the now filtered repository world. It currently update the unfiltered branchcache that few people cares about. Make it smarter on that aspect would need complexes update of the calling logic So this mechanism is: - Arguably needed, - Currently irrelevant, - Hard to update and I'm dropping it. We now update the branchcache in all case by courtesy of the read only reader. This changeset have a few expected impact on the testsuite are different cache are updated.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Wed, 16 Jan 2013 00:09:26 +0100
parents 5010448197bc
children dd3fd3353e23
comparison
equal deleted inserted replaced
18394:5010448197bc 18395:904b7109938e
1396 # causing those changes to disappear. 1396 # causing those changes to disappear.
1397 if '_phasecache' in vars(self): 1397 if '_phasecache' in vars(self):
1398 self._phasecache.write() 1398 self._phasecache.write()
1399 1399
1400 @unfilteredmethod 1400 @unfilteredmethod
1401 def destroyed(self, newheadnodes=None): 1401 def destroyed(self):
1402 '''Inform the repository that nodes have been destroyed. 1402 '''Inform the repository that nodes have been destroyed.
1403 Intended for use by strip and rollback, so there's a common 1403 Intended for use by strip and rollback, so there's a common
1404 place for anything that has to be done after destroying history. 1404 place for anything that has to be done after destroying history.
1405 1405
1406 If you know the branchheadcache was uptodate before nodes were removed 1406 If you know the branchheadcache was uptodate before nodes were removed
1419 # the removed nodes now and write the updated cache. 1419 # the removed nodes now and write the updated cache.
1420 if '_phasecache' in self._filecache: 1420 if '_phasecache' in self._filecache:
1421 self._phasecache.filterunknown(self) 1421 self._phasecache.filterunknown(self)
1422 self._phasecache.write() 1422 self._phasecache.write()
1423 1423
1424 # If we have info, newheadnodes, on how to update the branch cache, do 1424 # update branchcache information likely invalidated by the strip.
1425 # it, Otherwise, since nodes were destroyed, the cache is stale and this 1425 # We rely on branchcache collaboration for this call to be fast
1426 # will be caught the next time it is read. 1426 branchmap.updatecache(self)
1427 if newheadnodes:
1428 cl = self.changelog
1429 revgen = (cl.rev(node) for node in newheadnodes
1430 if cl.hasnode(node))
1431 cache = self._branchcaches[None]
1432 cache.update(self, revgen)
1433 cache.write(self)
1434 1427
1435 # Ensure the persistent tag cache is updated. Doing it now 1428 # Ensure the persistent tag cache is updated. Doing it now
1436 # means that the tag cache only has to worry about destroyed 1429 # means that the tag cache only has to worry about destroyed
1437 # heads immediately after a strip/rollback. That in turn 1430 # heads immediately after a strip/rollback. That in turn
1438 # guarantees that "cachetip == currenttip" (comparing both rev 1431 # guarantees that "cachetip == currenttip" (comparing both rev