##// END OF EJS Templates
posix: simplify checkexec check...
Mads Kiilerich -
r30445:1ce4c206 default
parent child Browse files
Show More
@@ -166,16 +166,16 b' def checkexec(path):'
166 166 fh, fn = tempfile.mkstemp(dir=cachedir, prefix='hg-checkexec-')
167 167 try:
168 168 os.close(fh)
169 m = os.stat(fn).st_mode & 0o777
170 new_file_has_exec = m & EXECFLAGS
171 os.chmod(fn, m ^ EXECFLAGS)
172 exec_flags_cannot_flip = ((os.stat(fn).st_mode & 0o777) == m)
169 m = os.stat(fn).st_mode
170 if m & EXECFLAGS:
171 return False
172 os.chmod(fn, m & 0o777 | EXECFLAGS)
173 return os.stat(fn).st_mode & EXECFLAGS
173 174 finally:
174 175 os.unlink(fn)
175 176 except (IOError, OSError):
176 177 # we don't care, the user probably won't be able to commit anyway
177 178 return False
178 return not (new_file_has_exec or exec_flags_cannot_flip)
179 179
180 180 def checklink(path):
181 181 """check whether the given path is on a symlink-capable filesystem"""
General Comments 0
You need to be logged in to leave comments. Login now