Comment 7 for bug 214825

Revision history for this message
Martin Pool (mbp) wrote : Re: [Bug 214825] Re: Doesn't support uploading symlinks

On 17 February 2010 16:32, Neil Santos <email address hidden> wrote:
>> That patch looks basically reasonable. You should put up a branch and
> propose a merge.
> I did that, except for the merge proposal.  I'm not comfortable asking
> the devs to merge something this hacky, so I'll try to work on it a bit
> more.  Luckily, I need bzr-upload to support symlinks for non-local
> transports, as well, so I can pretty well justify working on this.
>> I don't see why you can't do it on non-local transports as long as
>> they support symlinks? Similarly there's no reason why it should
>> matter whether the local os supports them or not. Instead just try it
>> and check for TransportNotPossible.
> My only objection is that I don't know how to do just that (not yet, in
> any case).  My Google-fu seems to be amiss when trying to figure out how
> bzrlib works, especially the Transport classes-- I would appreciate
> pointers towards the right direction.

There is some description in

However I'm sure there are good questions it doesn't answer, and we
would appreciate them being pointed out.

> At first, I thought I should give the Transport classes the ability to
> do symlinks by themselves, since, as I implied earlier, they don't seem
> to know how to do just that.  I still think this would be the best way
> to handle this, but I know so little about bzrlib and bzr-upload that I
> won't bet on it.

Yes, we should. In fact I thought they already did but I was totally wrong.

To do that:

1. add a method in the base Transport class that raises TransportNotPossible
2. implement it in LocalTransport by calling os.symlink
3. add a test in per_transport that tries to call it and if it
succeeds stats the file and checks its a symlink
4. implement in SftpTransport
5. probably add readlink() too

>> A test for this would be nice, if bzr-upload has enough test framework
>> to support it.
> I believe it does; I'm looking at the test suite right now and trying to
> figure out how to add tests for symlink support in.  I'm not really used
> to working with other people's code, let alone test suites.

Feel free to ask, we try to help

Martin <>