changeset 6878:202d178ec706

util: set_flags should survive failure to create link
author Matt Mackall <mpm@selenic.com>
date Sun, 10 Aug 2008 21:55:23 -0500
parents 1d38f3605b20
children 24fd94ed1cc0
files mercurial/util.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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):