[PATCH 3 of 4] destroyed: update `unserved` branchcache instead

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Jan 15 17:20:30 CST 2013


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1358289187 -3600
# Node ID 5175c9be5963aebd2a774015fd02050e924dbf63
# Parent  324ad5ba3de993f37342385a8369a5829b59011a
destroyed: update `unserved` branchcache instead


Before this changesets the `destroyed` function  updated the branchcache for
unfiltered repository. As seen in a previous changeset, Read only repo does
not cares about the unfiltered repo. We now update it for `unserved`.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1384,15 +1384,10 @@ class localrepository(object):
         to be flushed when the current lock is released. Because a call to
         destroyed is imminent, the repo will be invalidated causing those
         changes to stay in memory (waiting for the next unlock), or vanish
         completely.
         '''
-        # It simplifies the logic around updating the branchheads cache if we
-        # only have to consider the effect of the stripped revisions and not
-        # revisions missing because the cache is out-of-date.
-        branchmap.updatecache(self)
-
         # When using the same lock to commit and strip, the phasecache is left
         # dirty after committing. Then when we strip, the repo is invalidated,
         # causing those changes to disappear.
         if '_phasecache' in vars(self):
             self._phasecache.write()
@@ -1419,13 +1414,14 @@ class localrepository(object):
         # the removed nodes now and write the updated cache.
         if '_phasecache' in self._filecache:
             self._phasecache.filterunknown(self)
             self._phasecache.write()
 
-        # update branchcache information likely invalidated by the strip.
-        # We rely on branchcache collaboration for this call to be fast
-        branchmap.updatecache(self)
+        # update the 'served' branch cache to help read only server process
+        # Thanks to branchcach collaboration this is done from the nearest
+        # filtered subset and it is expected to be fast.
+        branchmap.updatecache(self.filtered('served'))
 
         # Ensure the persistent tag cache is updated.  Doing it now
         # means that the tag cache only has to worry about destroyed
         # heads immediately after a strip/rollback.  That in turn
         # guarantees that "cachetip == currenttip" (comparing both rev


More information about the Mercurial-devel mailing list