Mercurial > hg
changeset 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 | bebe7d1c38c8 |
children | a9ccd9af48ef |
files | mercurial/localrepo.py |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/localrepo.py Mon Jun 13 05:11:56 2016 +0900 +++ b/mercurial/localrepo.py Mon Jun 13 05:11:56 2016 +0900 @@ -1172,9 +1172,9 @@ vfsmap = {'plain': self.vfs, '': self.svfs} transaction.rollback(self.svfs, vfsmap, 'undo', ui.warn) if self.vfs.exists('undo.bookmarks'): - self.vfs.rename('undo.bookmarks', 'bookmarks') + self.vfs.rename('undo.bookmarks', 'bookmarks', checkambig=True) if self.svfs.exists('undo.phaseroots'): - self.svfs.rename('undo.phaseroots', 'phaseroots') + self.svfs.rename('undo.phaseroots', 'phaseroots', checkambig=True) self.invalidate() parentgone = (parents[0] not in self.changelog.nodemap or