util: set_flags should survive failure to create link
authorMatt Mackall <mpm@selenic.com>
Sun, 10 Aug 2008 21:55:23 -0500
changeset 6878 202d178ec706
parent 6877 1d38f3605b20
child 6879 24fd94ed1cc0
util: set_flags should survive failure to create link
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):