diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -568,6 +568,9 @@ coreconfigitem('experimental', 'treemanifest', default=False, ) +coreconfigitem('experimental', 'update.atomic-file', + default=False, +) coreconfigitem('extensions', '.*', default=None, generic=True, diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1112,6 +1112,8 @@ **kwargs) if 'x' in flags: self.wvfs.setflags(filename, False, True) + else: + self.wvfs.setflags(filename, False, False) return len(data) def wwritedata(self, filename, data): diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -1376,7 +1376,9 @@ if repo.wvfs.lexists(absf): util.rename(absf, orig) wctx[f].clearunknown() - wctx[f].write(fctx(f).data(), flags, backgroundclose=True) + atomictemp = ui.configbool("experimental", "update.atomic-file") + wctx[f].write(fctx(f).data(), flags, backgroundclose=True, + atomictemp=atomictemp) if i == 100: yield i, f i = 0