1411 and you also know the set of candidate new heads that may have resulted |
1411 and you also know the set of candidate new heads that may have resulted |
1412 from the destruction, you can set newheadnodes. This will enable the |
1412 from the destruction, you can set newheadnodes. This will enable the |
1413 code to update the branchheads cache, rather than having future code |
1413 code to update the branchheads cache, rather than having future code |
1414 decide it's invalid and regenerating it from scratch. |
1414 decide it's invalid and regenerating it from scratch. |
1415 ''' |
1415 ''' |
1416 # If we have info, newheadnodes, on how to update the branch cache, do |
|
1417 # it, Otherwise, since nodes were destroyed, the cache is stale and this |
|
1418 # will be caught the next time it is read. |
|
1419 if newheadnodes: |
|
1420 ctxgen = (self[node] for node in newheadnodes |
|
1421 if self.changelog.hasnode(node)) |
|
1422 cache = self._branchcaches[None] |
|
1423 cache.update(self, ctxgen) |
|
1424 cache.write(self) |
|
1425 |
|
1426 # When one tries to: |
1416 # When one tries to: |
1427 # 1) destroy nodes thus calling this method (e.g. strip) |
1417 # 1) destroy nodes thus calling this method (e.g. strip) |
1428 # 2) use phasecache somewhere (e.g. commit) |
1418 # 2) use phasecache somewhere (e.g. commit) |
1429 # |
1419 # |
1430 # then 2) will fail because the phasecache contains nodes that were |
1420 # then 2) will fail because the phasecache contains nodes that were |
1432 # causing it to reload next time it is accessed, or simply filter |
1422 # causing it to reload next time it is accessed, or simply filter |
1433 # the removed nodes now and write the updated cache. |
1423 # the removed nodes now and write the updated cache. |
1434 if '_phasecache' in self._filecache: |
1424 if '_phasecache' in self._filecache: |
1435 self._phasecache.filterunknown(self) |
1425 self._phasecache.filterunknown(self) |
1436 self._phasecache.write() |
1426 self._phasecache.write() |
|
1427 |
|
1428 # If we have info, newheadnodes, on how to update the branch cache, do |
|
1429 # it, Otherwise, since nodes were destroyed, the cache is stale and this |
|
1430 # will be caught the next time it is read. |
|
1431 if newheadnodes: |
|
1432 ctxgen = (self[node] for node in newheadnodes |
|
1433 if self.changelog.hasnode(node)) |
|
1434 cache = self._branchcaches[None] |
|
1435 cache.update(self, ctxgen) |
|
1436 cache.write(self) |
1437 |
1437 |
1438 # Ensure the persistent tag cache is updated. Doing it now |
1438 # Ensure the persistent tag cache is updated. Doing it now |
1439 # means that the tag cache only has to worry about destroyed |
1439 # means that the tag cache only has to worry about destroyed |
1440 # heads immediately after a strip/rollback. That in turn |
1440 # heads immediately after a strip/rollback. That in turn |
1441 # guarantees that "cachetip == currenttip" (comparing both rev |
1441 # guarantees that "cachetip == currenttip" (comparing both rev |