Mercurial > hg
changeset 29301:28f37ffc0a91
dirstate: make writing dirstate file out avoid ambiguity of file stat
Cached attribute repo.dirstate uses stat of '.hg/dirstate' file to
examine validity of cached contents. If writing '.hg/dirstate' file
out keeps ctime, mtime and size of it, change is overlooked, and old
contents cached before change isn't invalidated as expected.
To avoid ambiguity of file stat, this patch writes '.hg/dirstate' file
out with checkambig=True.
The former diff hunk changes the code path for "dirstate.write()", and
the latter changes the code path for "dirstate.savebackup()".
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 | Fri, 03 Jun 2016 00:44:20 +0900 |
parents | f92afd23a099 |
children | 083e107adaac |
files | mercurial/dirstate.py |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dirstate.py Fri Jun 03 00:44:20 2016 +0900 +++ b/mercurial/dirstate.py Fri Jun 03 00:44:20 2016 +0900 @@ -730,7 +730,7 @@ self._writedirstate, location='plain') return - st = self._opener(filename, "w", atomictemp=True) + st = self._opener(filename, "w", atomictemp=True, checkambig=True) self._writedirstate(st) def _writedirstate(self, st): @@ -1217,7 +1217,8 @@ # use '_writedirstate' instead of 'write' to write changes certainly, # because the latter omits writing out if transaction is running. # output file will be used to create backup of dirstate at this point. - self._writedirstate(self._opener(filename, "w", atomictemp=True)) + self._writedirstate(self._opener(filename, "w", atomictemp=True, + checkambig=True)) if tr: # ensure that subsequent tr.writepending returns True for