Mercurial > hg
comparison mercurial/util.py @ 5355:efe7ef325737
merge with -stable
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Tue, 02 Oct 2007 20:25:35 +0200 |
parents | 32ec518ee3cb 1df76921aab3 |
children | b98c377b3c16 |
comparison
equal
deleted
inserted
replaced
5354:9189ae05467d | 5355:efe7ef325737 |
---|---|
1093 """check whether a file is executable""" | 1093 """check whether a file is executable""" |
1094 return (os.lstat(f).st_mode & 0100 != 0) | 1094 return (os.lstat(f).st_mode & 0100 != 0) |
1095 | 1095 |
1096 def set_exec(f, mode): | 1096 def set_exec(f, mode): |
1097 s = os.lstat(f).st_mode | 1097 s = os.lstat(f).st_mode |
1098 if (s & 0100 != 0) == mode: | 1098 if stat.S_ISLNK(s) or (s & 0100 != 0) == mode: |
1099 return | 1099 return |
1100 if mode: | 1100 if mode: |
1101 # Turn on +x for every +r bit when making a file executable | 1101 # Turn on +x for every +r bit when making a file executable |
1102 # and obey umask. | 1102 # and obey umask. |
1103 os.chmod(f, s | (s & 0444) >> 2 & ~_umask) | 1103 os.chmod(f, s | (s & 0444) >> 2 & ~_umask) |