# HG changeset patch # User Thomas Arendsen Hein # Date 1118305448 -3600 # Node ID 91c9fd6a7c70d16838c7141aa06c152ef026bde2 # Parent 0dbcf3c9ff20a27a49eb5c369c3fb990d0bc0834 Turn on +x for every +r bit when making a file executable and obey umask. diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -18,7 +18,12 @@ def set_exec(f, mode): s = os.stat(f).st_mode if (s & 0100 != 0) == mode: return - os.chmod(f, s & 0666 | (mode * 0111)) + if mode: + umask = os.umask(0) + os.umask(umask) + os.chmod(f, s | (s & 0444) >> 2 & ~umask) + else: + os.chmod(f, s & 0666) class filelog(revlog): def __init__(self, opener, path):