diff 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 (2013-01-15)
parents 5010448197bc
children dd3fd3353e23
line wrap: on
line diff
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1398,7 +1398,7 @@
             self._phasecache.write()
 
     @unfilteredmethod
-    def destroyed(self, newheadnodes=None):
+    def destroyed(self):
         '''Inform the repository that nodes have been destroyed.
         Intended for use by strip and rollback, so there's a common
         place for anything that has to be done after destroying history.
@@ -1421,16 +1421,9 @@
             self._phasecache.filterunknown(self)
             self._phasecache.write()
 
-        # If we have info, newheadnodes, on how to update the branch cache, do
-        # it, Otherwise, since nodes were destroyed, the cache is stale and this
-        # will be caught the next time it is read.
-        if newheadnodes:
-            cl = self.changelog
-            revgen = (cl.rev(node) for node in newheadnodes
-                      if cl.hasnode(node))
-            cache = self._branchcaches[None]
-            cache.update(self, revgen)
-            cache.write(self)
+        # update branchcache information likely invalidated by the strip.
+        # We rely on branchcache collaboration for this call to be fast
+        branchmap.updatecache(self)
 
         # Ensure the persistent tag cache is updated.  Doing it now
         # means that the tag cache only has to worry about destroyed