Mercurial > public > mercurial-scm > hg-stable
diff mercurial/util.py @ 6884:11229144aa01
merge with crew-stable
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Tue, 12 Aug 2008 17:47:08 +0200 |
parents | 01db3e101362 202d178ec706 |
children | 4674706b5b95 |
line wrap: on
line diff
--- 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):