equal
deleted
inserted
replaced
158 # a FS remount. Frequently we can detect it if files are created |
158 # a FS remount. Frequently we can detect it if files are created |
159 # with exec bit on. |
159 # with exec bit on. |
160 |
160 |
161 try: |
161 try: |
162 EXECFLAGS = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH |
162 EXECFLAGS = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH |
163 fh, fn = tempfile.mkstemp(dir=path, prefix='hg-checkexec-') |
163 cachedir = os.path.join(path, '.hg', 'cache') |
|
164 if not os.path.isdir(cachedir): |
|
165 cachedir = path |
|
166 fh, fn = tempfile.mkstemp(dir=cachedir, prefix='hg-checkexec-') |
164 try: |
167 try: |
165 os.close(fh) |
168 os.close(fh) |
166 m = os.stat(fn).st_mode & 0o777 |
169 m = os.stat(fn).st_mode & 0o777 |
167 new_file_has_exec = m & EXECFLAGS |
170 new_file_has_exec = m & EXECFLAGS |
168 os.chmod(fn, m ^ EXECFLAGS) |
171 os.chmod(fn, m ^ EXECFLAGS) |