dirstate: make writing branch file out avoid ambiguity of file stat
Cached attribute dirstate._branch uses stat of '.hg/branch' file to
examine validity of cached contents. If writing '.hg/branch' 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/branch' file
out with checkambig=True.
This patch is a part of "Exact Cache Validation Plan":
https://www.mercurial-scm.org/wiki/ExactCacheValidationPlan
--- a/mercurial/dirstate.py Fri Jun 03 00:44:20 2016 +0900
+++ b/mercurial/dirstate.py Fri Jun 03 00:44:20 2016 +0900
@@ -367,7 +367,7 @@
def setbranch(self, branch):
self._branch = encoding.fromlocal(branch)
- f = self._opener('branch', 'w', atomictemp=True)
+ f = self._opener('branch', 'w', atomictemp=True, checkambig=True)
try:
f.write(self._branch + '\n')
f.close()