# HG changeset patch # User Pierre-Yves David # Date 1493744758 -7200 # Node ID a72caf0af38e06c231c2b00ac89fc7e0d50f9768 # Parent 604d65e2c0b2cdb78062bf783d8666fa37b4b197 caches: call 'repo.updatecache()' in 'repo.destroyed()' Regenerating the cache after a 'strip' or a 'rollback' is useful. So we call the generic cache warming function as other caches than just branchmap will be updated there in the future. To do so, we have to make 'repo.updatecache()' able to take no arguments. In such cases, we reload all caches. diff -r 604d65e2c0b2 -r a72caf0af38e mercurial/localrepo.py --- a/mercurial/localrepo.py Tue May 02 21:39:43 2017 +0200 +++ b/mercurial/localrepo.py Tue May 02 19:05:58 2017 +0200 @@ -1232,14 +1232,20 @@ return 0 @unfilteredmethod - def updatecaches(self, tr): - """warm appropriate caches after a transaction closed""" - if tr.hookargs.get('source') == 'strip': + def updatecaches(self, tr=None): + """warm appropriate caches + + If this function is called after a transaction closed. The transaction + will be available in the 'tr' argument. This can be used to selectively + update caches relevant to the changes in that transaction. + """ + if tr is not None and tr.hookargs.get('source') == 'strip': # During strip, many caches are invalid but # later call to `destroyed` will refresh them. return - if tr.changes['revs']: + if tr is None or tr.changes['revs']: + # updating the unfiltered branchmap should refresh all the others, branchmap.updatecache(self.filtered('served')) def invalidatecaches(self): @@ -1830,10 +1836,8 @@ self._phasecache.filterunknown(self) self._phasecache.write() - # update the 'served' branch cache to help read only server process - # Thanks to branchcache collaboration this is done from the nearest - # filtered subset and it is expected to be fast. - branchmap.updatecache(self.filtered('served')) + # refresh all repository caches + self.updatecaches() # Ensure the persistent tag cache is updated. Doing it now # means that the tag cache only has to worry about destroyed