plugin: sftp transport
John A Meinel
john at arbash-meinel.com
Tue Oct 18 22:35:24 BST 2005
> Here's a plugin for SFTP branch support using paramiko. It works as
> of at least bzr.dev at 1310, but the Transport interface seems to be in
> flux so... "Past performance does not guarantee future results." ;)
Thanks for all of your work.
>
> It requires at least verison 1.4 of paramiko, though 1.5 is probably
> better:
> http://www.lag.net/paramiko/
I know there has been some discussion (and I believe it was decided) about
using Twisted, which also provides sftp support. I'm guessing what you've
done can probably be adapted for it. But I know one reason I wasn't
persuing it heavily, is that I was waiting for Twisted to be integrated
first.
>
> I implemented the write support, too, but did NOT test it yet, since
> I'm not sure that part of the Transport API is really shaken out yet
> (does anything use it?). It works at least well enough for me to do:
>
Did you see the transport test suite, available in
bzrlib/selftest/testtransport.py?
There should also be an http test suite which inherits from it, so that
you can have an idea how to use it.
Basically, the test suite just makes sure that every function is
exercised, and that changes done over the transport, show up in the local
directory. (And vice versa). There is a parameter to indicate whether it
should consider the Transport to be readonly (which is used for http).
> $ bzr branch sftp://robey@example.com/foo/bar/stuff
>
> Read and write locks aren't supported, just like with HTTP. There's
> probably something clever I can do there, assuming we only care about
> read/write locking against other bzr-over-sftp instances, but I
> haven't put much thought into it.
Read locks would be nice, because it would let us cache things locally,
and guarantee that they aren't changing remotely. Write locks would be
nice when we go to support "bzr push" to a remote branch. (and when
Aaron's changes for remote bound-branches is implemented).
I know the SFTP v6 spec supported all sorts of nice things, but I believe
everyone is using v3, and I don't know what that does and doesn't
implement.
>
> You should just be able to stick this file into your ~/.bazaar/
> plugins/. If there's demand, I'll make a bzr branch for holding it,
> but it's pretty small right now.
It would be nice to have a directory with an __init__.py that also has the
test_suite(), so that running "bzr selftest" could also test the sftp
plugin.
If you look at my old sftp plugin (which spawns the sftp program, and has
*not* been updated to the latest Transport API) here:
http://bzr.arbash-meinel.com/plugins/sftp/
That at least should give you a reference to how __init__.py could look,
though the test_sftp is also using the older test suite.
>
> Oh yeah, this is mostly just ported from my last version, except
> using the new Transport API (which has been cleaned up a lot --
> thanks). I think probably the 'stat' call should go away and be
> replaced by more specific calls -- there's no way you're going to get
> 'stat' to work over HTTP. :)
In general 'stat' isn't needed. There are only a few places where it is
asked for. (Specifically in the "bzr info" command, which is really only
used in the local filesystem).
I'm not really sure how the interface was cleaned up, perhaps I moved the
LocalTransport calls into a separate class. Or maybe I just missed someone
else's work.
Maybe it was just because I separated everything into separate files, and
moved the test suite into selftest/testtransport.py
Anyway, thank you very much for your work, hopefully this can get tested,
and promoted to official plugin soon (and then possibly integrated) soon.
I would probably wait to integrate until we decide about dependencies.
But certainly we could tell people "if you want sftp support, install this
plugin, and paramiko". That way they don't need paramiko just to run bzr.
John
=:->
>
> robey
>
More information about the bazaar
mailing list