Transport w/ extra tests

Aaron Bentley aaron.bentley at utoronto.ca
Wed Jul 20 14:25:05 BST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John A Meinel wrote:
>> Perhaps you can use SimpleHttpServer for your tests.  Oh, and since http
>> does support PUT, maybe you should say "http PUT is not supported"
>> instead of "http does not support put" :-)
>>
> 
> Well, http PUT doesn't put files into the directory. You need webdav for
> that. 

No, actually, the way WebDAV supports uploading files is using the
vanilla http PUT directive.  It's not widely implemented outside of
WebDAV, but it wasn't introduced by it.

> (In theory you could have file uploading over GET, but that would
> only work for short files)

GET is not supposed to have side effects, so doing that is bad.  POST
can be used for uploading files of arbitrary length, though.

> And os.fork() doesn't exist on windows. Do we think threads are safer? 

I'm not really qualified to say.

> I
> could try and implement something using either os.spawn or subprocess,
> but we still have the problem that os.kill doesn't exist on windows
> either. (In the end we could create an HttpServer which would close when
> a specific URL was requested).

Yes, that sounds like it would work.  It would be nice if we could run
both the client and server with asyncore/chat.  That would allow us to
run them both in one process.

>> In terms of output, ElementTree defaults to ascii, but Martin's wrapper
>> changes that to utf-8.
> 
> 
> That's why those files were opened in non-decoded form. I agree the
> 'rb'/'r' isn't quite right, but that's what was used.

I've done some tests now, and ElementTree won't tolerate file-like
objects that produce unicode strings.  Ironic that it insists on doing
more work than we need it to.

I would suggest we either do

class Branch:
...
   def controlfile(filename, mode, decode=True);

Or else

class Branch:
...
   def controlfile(filename, mode):
...
   def binarycontrolfile(filename, mode):

Note that the definition of binary here is pretty much the same as the
open() interface, but the definition of non-binary here means 'unicode',
not 'newline translation'.

> Both of these have been done.
> My SftpTransport and RsyncTransport have not been updated yet, though.

Very nice.  We should see about rewiring Robey's SFTP stuff to use these
transports.  We might even use the SSH side of paramiko for the smart
server, later.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFC3lCx0F+nu1YWqI0RAqW2AJ9EqxQQagYkrjZoZ6exTjuO08CaDwCeOiEa
8ePtQ81vLLWb8emlpc9+cqs=
=0/U8
-----END PGP SIGNATURE-----




More information about the bazaar mailing list