comparison mercurial/localrepo.py @ 29352:37c7f9fb7040

localrepo: make restoring from backup at rollback avoid ambiguity of file stat Rollback of previous transaction restores contents of files below by renaming from 'undo.*' file. If renaming keeps ctime, mtime and size of a file, restoring is overlooked, and old contents cached before restoring isn't invalidated as expected. - .hg/bookmarks - .hg/phaseroots To avoid ambiguity of file stat at restoring, this patch invokes vfs.rename() with checkambig=True. BTW, .hg/dirstate is also restored at rollback. But it is restored by dirstate.restorebackup(), and previous patch already made it invoke vfs.rename() with checkambig=True. This patch is a part of "Exact Cache Validation Plan": https://www.mercurial-scm.org/wiki/ExactCacheValidationPlan
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Mon, 13 Jun 2016 05:11:56 +0900
parents 0d83ad967bf8
children 36fbd72c2f39
comparison
equal deleted inserted replaced
29351:bebe7d1c38c8 29352:37c7f9fb7040
1170 parents = self.dirstate.parents() 1170 parents = self.dirstate.parents()
1171 self.destroying() 1171 self.destroying()
1172 vfsmap = {'plain': self.vfs, '': self.svfs} 1172 vfsmap = {'plain': self.vfs, '': self.svfs}
1173 transaction.rollback(self.svfs, vfsmap, 'undo', ui.warn) 1173 transaction.rollback(self.svfs, vfsmap, 'undo', ui.warn)
1174 if self.vfs.exists('undo.bookmarks'): 1174 if self.vfs.exists('undo.bookmarks'):
1175 self.vfs.rename('undo.bookmarks', 'bookmarks') 1175 self.vfs.rename('undo.bookmarks', 'bookmarks', checkambig=True)
1176 if self.svfs.exists('undo.phaseroots'): 1176 if self.svfs.exists('undo.phaseroots'):
1177 self.svfs.rename('undo.phaseroots', 'phaseroots') 1177 self.svfs.rename('undo.phaseroots', 'phaseroots', checkambig=True)
1178 self.invalidate() 1178 self.invalidate()
1179 1179
1180 parentgone = (parents[0] not in self.changelog.nodemap or 1180 parentgone = (parents[0] not in self.changelog.nodemap or
1181 parents[1] not in self.changelog.nodemap) 1181 parents[1] not in self.changelog.nodemap)
1182 if parentgone: 1182 if parentgone: