--- a/mercurial/util.py Sun Aug 10 18:38:43 2008 -0500
+++ b/mercurial/util.py Tue Aug 12 17:47:08 2008 +0200
@@ -1069,7 +1069,7 @@
'''return False if pid dead, True if running or not known'''
return True
- def set_flags(f, flags):
+ def set_flags(f, l, x):
pass
def set_binary(fd):
@@ -1216,16 +1216,18 @@
"""check whether a file is executable"""
return (os.lstat(f).st_mode & 0100 != 0)
- def set_flags(f, flags):
+ def set_flags(f, l, x):
s = os.lstat(f).st_mode
- x = "x" in flags
- l = "l" in flags
if l:
if not stat.S_ISLNK(s):
# switch file to link
data = file(f).read()
os.unlink(f)
- os.symlink(data, f)
+ try:
+ os.symlink(data, f)
+ except:
+ # failed to make a link, rewrite file
+ file(f, "w").write(data)
# no chmod needed at this point
return
if stat.S_ISLNK(s):