Patchwork [12,of,18,V2] destroyed: filter unknow before computing branchcache

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 4, 2013, 1:04 a.m.
Message ID <cbf55b9764e718ea3165.1357261455@yamac.lan>
Download mbox | patch
Permalink /patch/381/
State Accepted
Headers show

Comments

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

Branchcache of filtered version need up to date phase data.
Kevin Bullock - Jan. 4, 2013, 7:06 p.m.
On Jan 3, 2013, at 7:04 PM, Pierre-Yves David wrote:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
> # Date 1356663311 -3600
> # Node ID cbf55b9764e718ea3165cdd480facff39ef737d1
> # Parent  7fdca0e69744a4eca0b6ac648a747f0013290fc9
> destroyed: filter unknow before computing branch cache

Pulled fixed versions of 9-12 and pushed to crew as 6d6d0248530b.

pacem in terris / ??? / ?????? / ????????? / ??
Kevin R. Bullock

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.