comparison mercurial/localrepo.py @ 18221:082d6929fd4d

localrepo: filter unknown nodes from the phasecache on destroyed When commit is followed by strip (qrefresh), phasecache contains nodes that were removed from the changelog. Since phasecache is filecached with .hg/store/phaseroots which doesn't change as a result of stripping, we have to filter it manually. If we don't write it immediately, the next time it is read from disk the nodes will be filtered again. That's what happened before, but there's no reason not to write it immediately. The change in test-keyword.t is caused by the above.
author Idan Kamara <idankk86@gmail.com>
date Fri, 21 Dec 2012 17:19:52 +0100
parents c565761dde6a
children 47f00b0de337
comparison
equal deleted inserted replaced
18220:767d1c602c8b 18221:082d6929fd4d
1422 ctxgen = (self[node] for node in newheadnodes 1422 ctxgen = (self[node] for node in newheadnodes
1423 if self.changelog.hasnode(node)) 1423 if self.changelog.hasnode(node))
1424 cache = self._branchcaches[None] 1424 cache = self._branchcaches[None]
1425 cache.update(self, ctxgen) 1425 cache.update(self, ctxgen)
1426 cache.write(self) 1426 cache.write(self)
1427
1428 # When one tries to:
1429 # 1) destroy nodes thus calling this method (e.g. strip)
1430 # 2) use phasecache somewhere (e.g. commit)
1431 #
1432 # then 2) will fail because the phasecache contains nodes that were
1433 # removed. We can either remove phasecache from the filecache,
1434 # causing it to reload next time it is accessed, or simply filter
1435 # the removed nodes now and write the updated cache.
1436 if '_phasecache' in self._filecache:
1437 self._phasecache.filterunknown(self)
1438 self._phasecache.write()
1427 1439
1428 # Ensure the persistent tag cache is updated. Doing it now 1440 # Ensure the persistent tag cache is updated. Doing it now
1429 # means that the tag cache only has to worry about destroyed 1441 # means that the tag cache only has to worry about destroyed
1430 # heads immediately after a strip/rollback. That in turn 1442 # heads immediately after a strip/rollback. That in turn
1431 # guarantees that "cachetip == currenttip" (comparing both rev 1443 # guarantees that "cachetip == currenttip" (comparing both rev