changeset 30444:b1ce25a40826

posix: move checkexec test file to .hg/cache This avoids unnecessary churn in the working directory. It is not necessarily a fully valid assumption that .hg/cache is on the same filesystem as the working directory, but I think it is an acceptable approximation. It could also be the case that different parts of the working directory is on different mount points so checking in the root folder could also be wrong.
author Mads Kiilerich <madski@unity3d.com>
date Thu, 17 Nov 2016 12:59:36 +0100
parents 4e1eab73c53d
children 1ce4c2062ab0
files mercurial/posix.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/posix.py	Thu Nov 17 15:31:19 2016 -0800
+++ b/mercurial/posix.py	Thu Nov 17 12:59:36 2016 +0100
@@ -160,7 +160,10 @@
 
     try:
         EXECFLAGS = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
-        fh, fn = tempfile.mkstemp(dir=path, prefix='hg-checkexec-')
+        cachedir = os.path.join(path, '.hg', 'cache')
+        if not os.path.isdir(cachedir):
+            cachedir = path
+        fh, fn = tempfile.mkstemp(dir=cachedir, prefix='hg-checkexec-')
         try:
             os.close(fh)
             m = os.stat(fn).st_mode & 0o777