Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 5236:335696e2a58f
merge with crew-stable
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Fri, 24 Aug 2007 00:39:59 +0200 |
parents | 1108c952cca1 b0bc8cf41ffc |
children | 46c5e1ee8aaa |
comparison
equal
deleted
inserted
replaced
5235:988ed47d9d65 | 5236:335696e2a58f |
---|---|
848 """ | 848 """ |
849 Check whether the given path is on a filesystem with UNIX-like exec flags | 849 Check whether the given path is on a filesystem with UNIX-like exec flags |
850 | 850 |
851 Requires a directory (like /foo/.hg) | 851 Requires a directory (like /foo/.hg) |
852 """ | 852 """ |
853 fh, fn = tempfile.mkstemp("", "", path) | 853 try: |
854 os.close(fh) | 854 fh, fn = tempfile.mkstemp("", "", path) |
855 m = os.stat(fn).st_mode | 855 os.close(fh) |
856 os.chmod(fn, m ^ 0111) | 856 m = os.stat(fn).st_mode |
857 r = (os.stat(fn).st_mode != m) | 857 os.chmod(fn, m ^ 0111) |
858 os.unlink(fn) | 858 r = (os.stat(fn).st_mode != m) |
859 os.unlink(fn) | |
860 except (IOError,OSError): | |
861 # we don't care, the user probably won't be able to commit anyway | |
862 return False | |
859 return r | 863 return r |
860 | 864 |
861 def execfunc(path, fallback): | 865 def execfunc(path, fallback): |
862 '''return an is_exec() function with default to fallback''' | 866 '''return an is_exec() function with default to fallback''' |
863 if checkexec(path): | 867 if checkexec(path): |