diff mercurial/localrepo.py @ 4137:26596a6b6518

Create the parent directory when checking out symlinks.
author Giorgos Keramidas <keramida@ceid.upatras.gr>
date Fri, 23 Feb 2007 17:54:34 +0200
parents 9dc64c8414ca
children b4bd2f3ea347
line wrap: on
line diff
--- a/mercurial/localrepo.py	Fri Jan 05 21:28:49 2007 +0200
+++ b/mercurial/localrepo.py	Fri Feb 23 17:54:34 2007 +0200
@@ -525,11 +525,15 @@
     def wwrite(self, filename, data, flags):
         data = self._filter("decode", filename, data)
         if "l" in flags:
+            f = self.wjoin(filename)
             try:
-                os.unlink(self.wjoin(filename))
+                os.unlink(f)
             except OSError:
                 pass
-            os.symlink(data, self.wjoin(filename))
+            d = os.path.dirname(f)
+            if not os.path.exists(d):
+                os.makedirs(d)
+            os.symlink(data, f)
         else:
             try:
                 if self._link(filename):