transaction: avoid ambiguity of file stat at closing transaction
Files below, which might be changed at closing transaction, are used
to examine validity of cached properties. If changing keeps ctime,
mtime and size of a file, change is overlooked, and old contents
cached before change isn't invalidated as expected.
- .hg/bookmarks
- .hg/dirstate
- .hg/phaseroots
To avoid ambiguity of file stat, this patch writes files out with
checkambig=True at closing transaction.
checkambig becomes True only at closing (= 'not suffix'), because stat
information of '.pending' file isn't used to examine validity of
cached properties.
This patch is a part of "Exact Cache Validation Plan":
https://www.mercurial-scm.org/wiki/ExactCacheValidationPlan
--- a/mercurial/transaction.py Fri Jun 03 00:44:20 2016 +0900
+++ b/mercurial/transaction.py Fri Jun 03 00:44:20 2016 +0900
@@ -310,7 +310,8 @@
self.registertmp(name, location=location)
else:
self.addbackup(name, location=location)
- files.append(vfs(name, 'w', atomictemp=True))
+ files.append(vfs(name, 'w', atomictemp=True,
+ checkambig=not suffix))
genfunc(*files)
finally:
for f in files: