comparison mercurial/localrepo.py @ 18757:1c8e0d6ac3b0 stable

localrepo: always write the filtered phasecache when nodes are destroyed (issue3827) When the strip command is run, it calls repo.destroyed, which in turn checks if we read _phasecache, and if we did calls filterunknown on it and flushes the changes immediately. But in some cases, nothing causes _phasecache to be read, so we miss out on this and the file remains the same on-disk. Then a call to invalidate comes, which should refresh _phasecache if it changed, but it didn't, so it keeps using the old one with the stripped revision which causes an IndexError. Test written by Yuya Nishihara.
author Idan Kamara <idankk86@gmail.com>
date Sat, 23 Mar 2013 13:34:50 +0200
parents 5b7175377bab
children 0377352eb7d3
comparison
equal deleted inserted replaced
18756:76d49dab6a00 18757:1c8e0d6ac3b0
1414 # 1414 #
1415 # then 2) will fail because the phasecache contains nodes that were 1415 # then 2) will fail because the phasecache contains nodes that were
1416 # removed. We can either remove phasecache from the filecache, 1416 # removed. We can either remove phasecache from the filecache,
1417 # causing it to reload next time it is accessed, or simply filter 1417 # causing it to reload next time it is accessed, or simply filter
1418 # the removed nodes now and write the updated cache. 1418 # the removed nodes now and write the updated cache.
1419 if '_phasecache' in self._filecache: 1419 self._phasecache.filterunknown(self)
1420 self._phasecache.filterunknown(self) 1420 self._phasecache.write()
1421 self._phasecache.write()
1422 1421
1423 # update the 'served' branch cache to help read only server process 1422 # update the 'served' branch cache to help read only server process
1424 # Thanks to branchcach collaboration this is done from the nearest 1423 # Thanks to branchcach collaboration this is done from the nearest
1425 # filtered subset and it is expected to be fast. 1424 # filtered subset and it is expected to be fast.
1426 branchmap.updatecache(self.filtered('served')) 1425 branchmap.updatecache(self.filtered('served'))