diff 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
line wrap: on
line diff
--- a/mercurial/localrepo.py	Tue Mar 19 16:19:20 2013 -0700
+++ b/mercurial/localrepo.py	Sat Mar 23 13:34:50 2013 +0200
@@ -1416,9 +1416,8 @@
         # removed. We can either remove phasecache from the filecache,
         # causing it to reload next time it is accessed, or simply filter
         # the removed nodes now and write the updated cache.
-        if '_phasecache' in self._filecache:
-            self._phasecache.filterunknown(self)
-            self._phasecache.write()
+        self._phasecache.filterunknown(self)
+        self._phasecache.write()
 
         # update the 'served' branch cache to help read only server process
         # Thanks to branchcach collaboration this is done from the nearest