changeset 29351:bebe7d1c38c8

dirstate: make restoring from backup avoid ambiguity of file stat File .hg/dirstate is restored by renaming from backup in failure inside scopes below. If renaming keeps ctime, mtime and size of a file, restoring is overlooked, and old contents cached before restoring isn't invalidated as expected. - dirstateguard scope (from '.hg/dirstate.SUFFIX') - transaction scope (from '.hg/journal.dirstate') To avoid ambiguity of file stat at restoring, this patch invokes 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 35861cc1076e
children 37c7f9fb7040
files mercurial/dirstate.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Sat Jun 11 20:59:49 2016 +0200
+++ b/mercurial/dirstate.py	Mon Jun 13 05:11:56 2016 +0900
@@ -1243,7 +1243,8 @@
         self.invalidate()
         filename = self._actualfilename(tr)
         # using self._filename to avoid having "pending" in the backup filename
-        self._opener.rename(prefix + self._filename + suffix, filename)
+        self._opener.rename(prefix + self._filename + suffix, filename,
+                            checkambig=True)
 
     def clearbackup(self, tr, suffix='', prefix=''):
         '''Clear backup file with suffix'''