# HG changeset patch # User Dov Feldstern # Date 1212934750 -10800 # Node ID 7f656bf1904c760c3cb9b8d859ab538443266f61 # Parent a51093361e1c76cf27124a76417fc118d8fa60c1 fix symlinks on symlink-capable os but non-symlink-capable filesystem 1. write a symlink directly as a symlink (currently it's being written as a file, and only then switched to a symlink by set_flags); note that writing as a symlink already makes sure that the fs supports symlinks. 2. set_flags should only switch a file to a symlink on a symlink-capable fs. diff -r a51093361e1c -r 7f656bf1904c mercurial/localrepo.py --- a/mercurial/localrepo.py Sat Jun 07 17:52:00 2008 +0200 +++ b/mercurial/localrepo.py Sun Jun 08 17:19:10 2008 +0300 @@ -566,7 +566,10 @@ os.unlink(self.wjoin(filename)) except OSError: pass - self.wopener(filename, 'w').write(data) + if 'l' in flags: + self.wopener.symlink(data, filename) + else: + self.wopener(filename, 'w').write(data) util.set_flags(self.wjoin(filename), flags) def wwritedata(self, filename, data): diff -r a51093361e1c -r 7f656bf1904c mercurial/util.py --- a/mercurial/util.py Sat Jun 07 17:52:00 2008 +0200 +++ b/mercurial/util.py Sun Jun 08 17:19:10 2008 +0300 @@ -1180,7 +1180,7 @@ x = "x" in flags l = "l" in flags if l: - if not stat.S_ISLNK(s): + if checklink(os.path.dirname(f)) and not stat.S_ISLNK(s): # switch file to link data = file(f).read() os.unlink(f)