[PATCH 12 of 18 V2] destroyed: filter unknow before computing branchcache
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Fri Jan 4 01:04:15 UTC 2013
# 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.
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.
More information about the Mercurial-devel
mailing list