Merge with TAH
authormpm@selenic.com
Thu, 09 Jun 2005 09:48:50 -0800
changeset 299 7c239fad0f27
parent 296 a3d83bf86755 (current diff)
parent 298 91c9fd6a7c70 (diff)
child 300 d3400605d246
child 303 15a9e55e7ea5
Merge with TAH -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Merge with TAH manifest hash: 5a7d047acc6df6ba03db532657f54c0d38e4cffe -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD4DBQFCqIECywK+sNU5EO8RAg56AJ95hB6uw7Fc55XgwgZls4UUNRt1jACYrkrq V9VJhhv29Fd/LEZy+ydoGQ== =unEK -----END PGP SIGNATURE-----
mercurial/hg.py
--- a/mercurial/hg.py	Thu Jun 09 09:41:21 2005 -0800
+++ b/mercurial/hg.py	Thu Jun 09 09:48:50 2005 -0800
@@ -18,7 +18,14 @@
     s = os.stat(f).st_mode
     if (s & 0100 != 0) == mode:
         return
-    os.chmod(f, s & 0666 | (mode * 0111))
+    if mode:
+        # Turn on +x for every +r bit when making a file executable
+        # and obey umask.
+        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):
@@ -1003,7 +1010,7 @@
             try:
                 self.wfile(f, "w").write(t)
             except IOError:
-                os.makedirs(os.path.dirname(wp))
+                os.makedirs(os.path.dirname(self.wjoin(f)))
                 self.wfile(f, "w").write(t)
             set_exec(self.wjoin(f), mf2[f])
             self.dirstate.update([f], mode)
@@ -1015,7 +1022,7 @@
             self.ui.status("merging %s\n" % f)
             m, o, flag = merge[f]
             self.merge3(f, m, o)
-            set_exec(wp, flag)
+            set_exec(self.wjoin(f), flag)
             self.dirstate.update([f], 'm')
 
         for f in remove: