requires: use atomictemp=True when writing .hg/requires
authorMartin von Zweigbergk <martinvonz@google.com>
Wed, 14 Nov 2018 11:30:46 -0800
changeset 40635 acd17caa699a
parent 40634 c9876c00d292
child 40636 8c6329fa6038
requires: use atomictemp=True when writing .hg/requires We use an unusual file system at Google that allows writes (and renames) but not deletions (for certain paths). That causes problems when writing the requires files without atomictemp=True. There doesn't appear to be any real drawbacks to using atomictemp, so I'm hoping we can just change it in core. Differential Revision: https://phab.mercurial-scm.org/D5274
mercurial/scmutil.py
--- a/mercurial/scmutil.py	Sun Nov 11 16:47:28 2018 +0900
+++ b/mercurial/scmutil.py	Wed Nov 14 11:30:46 2018 -0800
@@ -1166,7 +1166,7 @@
             wctx.copy(origsrc, dst)
 
 def writerequires(opener, requirements):
-    with opener('requires', 'w') as fp:
+    with opener('requires', 'w', atomictemp=True) as fp:
         for r in sorted(requirements):
             fp.write("%s\n" % r)