D5274: requires: use atomictemp=True when writing .hg/requires

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed Nov 14 20:05:51 UTC 2018


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5274

AFFECTED FILES
  mercurial/scmutil.py

CHANGE DETAILS

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -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)
 



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list