Print meaningful error message if os.symlink fails
authorBryan O'Sullivan <bos@serpentine.com>
Thu, 19 Jul 2007 15:29:33 -0700
changeset 4948 c8d1aa1822d5
parent 4947 3e25a6eb5c9a
child 4949 2f0f9528e77b
Print meaningful error message if os.symlink fails
mercurial/util.py
--- a/mercurial/util.py	Thu Jul 19 15:13:48 2007 -0700
+++ b/mercurial/util.py	Thu Jul 19 15:29:33 2007 -0700
@@ -1303,7 +1303,11 @@
             os.makedirs(dirname)
 
         if self._can_symlink:
-            os.symlink(src, linkname)
+            try:
+                os.symlink(src, linkname)
+            except OSError, err:
+                raise OSError(err.errno, _('could not symlink to %r: %s') %
+                              (src, err.strerror), linkname)
         else:
             f = self(self, dst, "w")
             f.write(src)