Checking out repo with symlinks on windows

Mark Grandi markgrandi at gmail.com
Sun Aug 21 11:12:35 UTC 2011


So, i have this repository that has a symlink in it, and it turns out that i
cannot check out / branch that repository on windows because bazaar doesn't
support it.

I looked around and saw there was already a bug report for this here:
https://bugs.launchpad.net/bzr/+bug/81689 alllll the way from 2006 and its
still not fixed. Part of the problem is that python itself didn't have
support for os.path.symlink and os.path.islink for a long time, but even
though the bug is already closed (http://bugs.python.org/issue1578269), it
only seems to work in python 3.x, and not in python 2.7, and waiting for
bazaar to go to python 3 is not really an option.

I researched how other version control systems deal with this, and it seems
that git (msysgit at least) converts the symlink to a text file with the
path as the text, while command line git tries to restore them, and has a
setting to make it convert the sym link into a text file. No idea what it
does if that variable is not set and you try to clone into a windows machine
(links:
http://stackoverflow.com/questions/954560/what-does-git-do-to-files-that-are-a-symbolic-linkand
http://stackoverflow.com/questions/5917249/git-symlinks-in-windows, and
http://code.google.com/p/msysgit/issues/detail?id=224)

In SVN, it seems to just convert symlinks into a normal file on windows
(from http://subversion.apache.org/faq.html#symlinks)

in mercurial , it also seems to do the conversion of a symlink into a file
(from
http://stackoverflow.com/questions/1967973/mercurial-symlinks-on-windows)

so, we see a pattern here. While it would be awesome to convert a unix
symlink into a windows link or junction or whatever, since there seems to be
problems with requiring administration privileges to actually create the
link (or at least the default windows settings are set up that way, its
possible to make other accounts have that privilege however you need to do
it manually), why doesn't bazaar do this as well?

I talked about this on the #bzr irc and someone suggested:

 >But I think it'd be possible to arrange for the code to do something like
"if platform == 'win32' and dirstate_kind == 'symlink' and disk_kind ==
'file': pretend disk kind is symlink"
> Why? Because 'bzr status' etc looks at what's on disk (with os.stat,
basically) and reports 'file', 'directory', 'symlink'.

While i know python, I don't know much about the bazaar codebase. If bazaar
actually saves the kind of the file as a symlink, then it would be easy to
convert the file into a text file with just the path on windows, however i
have no idea what would happen if the user edited that file, and how it
would save the information in the repo.

I just feel this bug should at least be fixed enough where windows users can
actually download the repository instead of not being able to at all.

~mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/bazaar/attachments/20110821/2c88ca53/attachment.html>


More information about the bazaar mailing list