comparison mercurial/util.py @ 4326:5e3936eabe5d

pull umask-checking up
author Matt Mackall <mpm@selenic.com>
date Fri, 29 Dec 2006 20:04:30 -0600
parents c93562fb12cc
children aba90193f4e4
comparison
equal deleted inserted replaced
4324:cd650cd61b06 4326:5e3936eabe5d
849 except ImportError: 849 except ImportError:
850 pass 850 pass
851 851
852 else: 852 else:
853 nulldev = '/dev/null' 853 nulldev = '/dev/null'
854 _umask = os.umask(0)
855 os.umask(_umask)
854 856
855 def rcfiles(path): 857 def rcfiles(path):
856 rcs = [os.path.join(path, 'hgrc')] 858 rcs = [os.path.join(path, 'hgrc')]
857 rcdir = os.path.join(path, 'hgrc.d') 859 rcdir = os.path.join(path, 'hgrc.d')
858 try: 860 try:
890 if (s & 0100 != 0) == mode: 892 if (s & 0100 != 0) == mode:
891 return 893 return
892 if mode: 894 if mode:
893 # Turn on +x for every +r bit when making a file executable 895 # Turn on +x for every +r bit when making a file executable
894 # and obey umask. 896 # and obey umask.
895 umask = os.umask(0) 897 os.chmod(f, s | (s & 0444) >> 2 & ~_umask)
896 os.umask(umask)
897 os.chmod(f, s | (s & 0444) >> 2 & ~umask)
898 else: 898 else:
899 os.chmod(f, s & 0666) 899 os.chmod(f, s & 0666)
900 900
901 def set_binary(fd): 901 def set_binary(fd):
902 pass 902 pass