Patchwork [10,of,16] destroyed: filter unknow before computing branchcache

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 2, 2013, 1:09 a.m.
Message ID <d149d6401ce3da07faa2.1357088972@yamac.lan>
Download mbox | patch
Permalink /patch/355/
State Superseded, archived
Headers show

Comments

Pierre-Yves David - Jan. 2, 2013, 1:09 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1356663311 -3600
# Node ID d149d6401ce3da07faa2c62dd21ae7a0a0d375a5
# Parent  e6feab1c4e7f62274693b0c1f1d535efb6fcc984
destroyed: filter unknow before computing branchcache

Branchcache of filtered version need up to date phase data.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1411,20 +1411,10 @@  class localrepository(object):
         and you also know the set of candidate new heads that may have resulted
         from the destruction, you can set newheadnodes.  This will enable the
         code to update the branchheads cache, rather than having future code
         decide it's invalid and regenerating it from scratch.
         '''
-        # 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:
-            ctxgen = (self[node] for node in newheadnodes
-                      if self.changelog.hasnode(node))
-            cache = self._branchcaches[None]
-            cache.update(self, ctxgen)
-            cache.write(self)
-
         # When one tries to:
         # 1) destroy nodes thus calling this method (e.g. strip)
         # 2) use phasecache somewhere (e.g. commit)
         #
         # then 2) will fail because the phasecache contains nodes that were
@@ -1433,10 +1423,20 @@  class localrepository(object):
         # the removed nodes now and write the updated cache.
         if '_phasecache' in self._filecache:
             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:
+            ctxgen = (self[node] for node in newheadnodes
+                      if self.changelog.hasnode(node))
+            cache = self._branchcaches[None]
+            cache.update(self, ctxgen)
+            cache.write(self)
+
         # 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
         # and node) always means no nodes have been added or destroyed.