changeset 298:91c9fd6a7c70

Turn on +x for every +r bit when making a file executable and obey umask.
author Thomas Arendsen Hein <thomas@intevation.de>
date Thu, 09 Jun 2005 09:24:08 +0100
parents 0dbcf3c9ff20
children 7c239fad0f27
files mercurial/hg.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hg.py	Thu Jun 09 08:53:07 2005 +0100
+++ b/mercurial/hg.py	Thu Jun 09 09:24:08 2005 +0100
@@ -18,7 +18,12 @@
     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):