comparison mercurial/util.py @ 3996:c190df14338c

exec: add execfunc to simplify exec flag support on non-exec filesystems
author Matt Mackall <mpm@selenic.com>
date Fri, 29 Dec 2006 20:04:30 -0600
parents a4e79f86d304
children 3f0ba82c103f
comparison
equal deleted inserted replaced
3995:a4e79f86d304 3996:c190df14338c
705 os.chmod(fn, m ^ 0111) 705 os.chmod(fn, m ^ 0111)
706 r = (os.stat(fn).st_mode != m) 706 r = (os.stat(fn).st_mode != m)
707 os.unlink(fn) 707 os.unlink(fn)
708 return r 708 return r
709 709
710 def execfunc(path, fallback):
711 '''return an is_exec() function with default to fallback'''
712 if checkexec(path):
713 return lambda x: is_exec(os.path.join(path, x), False)
714 return fallback
715
710 # Platform specific variants 716 # Platform specific variants
711 if os.name == 'nt': 717 if os.name == 'nt':
712 import msvcrt 718 import msvcrt
713 nulldev = 'NUL:' 719 nulldev = 'NUL:'
714 720