# HG changeset patch # User Matt Mackall # Date 1218423323 18000 # Node ID 202d178ec706885077c646d4f09e3ad194a5335d # Parent 1d38f3605b205b5c1b22e8e82b551a05ebe799da util: set_flags should survive failure to create link diff -r 1d38f3605b20 -r 202d178ec706 mercurial/util.py --- a/mercurial/util.py Sun Aug 10 21:55:06 2008 -0500 +++ b/mercurial/util.py Sun Aug 10 21:55:23 2008 -0500 @@ -1150,7 +1150,11 @@ # 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):