set_exec: do not chmod a symlink
authorSteve Borho <steve@ageia.com>
Tue, 02 Oct 2007 20:22:33 +0200
changeset 5347 1df76921aab3
parent 5346 8838fe5a236f
child 5355 efe7ef325737
child 5364 645a40777fd4
set_exec: do not chmod a symlink
mercurial/util.py
--- a/mercurial/util.py	Sun Sep 30 16:36:22 2007 +0200
+++ b/mercurial/util.py	Tue Oct 02 20:22:33 2007 +0200
@@ -14,7 +14,7 @@
 
 from i18n import _
 import cStringIO, errno, getpass, popen2, re, shutil, sys, tempfile
-import os, threading, time, calendar, ConfigParser, locale, glob
+import os, stat, threading, time, calendar, ConfigParser, locale, glob
 
 try:
     set = set
@@ -1047,7 +1047,7 @@
 
     def set_exec(f, mode):
         s = os.lstat(f).st_mode
-        if (s & 0100 != 0) == mode:
+        if stat.S_ISLNK(s) or (s & 0100 != 0) == mode:
             return
         if mode:
             # Turn on +x for every +r bit when making a file executable