[PATCH 3 of 5] vfs: make atomictempfile avoid ambiguity of file stat if needed

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Wed May 18 11:26:29 EDT 2016


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1463584838 -32400
#      Thu May 19 00:20:38 2016 +0900
# Node ID 8b45962710be55e598df3282752396fd1275fc84
# Parent  561ed91a420adfee1e1386e6dd20fea5ad8c1db5
vfs: make atomictempfile avoid ambiguity of file stat if needed

This patch is a part of preparation for "Exact Cache Validation Plan":

    https://www.mercurial-scm.org/wiki/ExactCacheValidationPlan

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -502,7 +502,7 @@ class vfs(abstractvfs):
         os.chmod(name, self.createmode & 0o666)
 
     def __call__(self, path, mode="r", text=False, atomictemp=False,
-                 notindexed=False, backgroundclose=False):
+                 notindexed=False, backgroundclose=False, checkambig=False):
         '''Open ``path`` file, which is relative to vfs root.
 
         Newly created directories are marked as "not to be indexed by
@@ -521,6 +521,8 @@ class vfs(abstractvfs):
            closing a file on a background thread and reopening it. (If the
            file were opened multiple times, there could be unflushed data
            because the original file handle hasn't been flushed/closed yet.)
+
+        ``checkambig`` is passed to atomictempfile (valid only for writing).
         '''
         if self._audit:
             r = util.checkosfilename(path)
@@ -540,7 +542,8 @@ class vfs(abstractvfs):
             if basename:
                 if atomictemp:
                     util.makedirs(dirname, self.createmode, notindexed)
-                    return util.atomictempfile(f, mode, self.createmode)
+                    return util.atomictempfile(f, mode, self.createmode,
+                                               checkambig=checkambig)
                 try:
                     if 'w' in mode:
                         util.unlink(f)


More information about the Mercurial-devel mailing list