comparison mercurial/localrepo.py @ 35726:45b678bf3a78

atomicupdate: add an experimental option to use atomictemp when updating In some cases Mercurial truncating files when updating causes problems. It can happens when processes are currently reading the file or with big file or on NFS mounts. We add an experimental option to use the atomictemp option of vfs.__call__ in order to avoid the problem. The localrepository.wwrite seems to assume the files are created without the `x` flag; with atomictempfile, the new file might inherit the `x` flag from the destination. We force remove it afterward. This code could be refactored and the flag processing could be moved inside vfs. This patch should be tested with `--extra-config-opt experimental.update.atomic-file=True` as we disabled the option by default. Differential Revision: https://phab.mercurial-scm.org/D1882
author Boris Feld <boris.feld@octobus.net>
date Wed, 17 Jan 2018 17:07:55 +0100
parents 2a7e777c9eed
children 29f57ce416ed
comparison
equal deleted inserted replaced
35725:2a7e777c9eed 35726:45b678bf3a78
1110 else: 1110 else:
1111 self.wvfs.write(filename, data, backgroundclose=backgroundclose, 1111 self.wvfs.write(filename, data, backgroundclose=backgroundclose,
1112 **kwargs) 1112 **kwargs)
1113 if 'x' in flags: 1113 if 'x' in flags:
1114 self.wvfs.setflags(filename, False, True) 1114 self.wvfs.setflags(filename, False, True)
1115 else:
1116 self.wvfs.setflags(filename, False, False)
1115 return len(data) 1117 return len(data)
1116 1118
1117 def wwritedata(self, filename, data): 1119 def wwritedata(self, filename, data):
1118 return self._filter(self._decodefilterpats, filename, data) 1120 return self._filter(self._decodefilterpats, filename, data)
1119 1121