[merge] Transport.*_{bytes,file}

John Arbash Meinel john at arbash-meinel.com
Tue Sep 5 23:56:30 BST 2006


The attached patch changes the Transport api, such that append() and
put() are deprecated, and meant to be replaced by
append_bytes/append_file, put_bytes/put_file. This is mostly for api
clarity. (It also helps that you can now grep for append_{file,bytes}
rather than getting false positives on all of the list.append() calls).
The patch also changes all of bzrlib to use these new functions.

I implement 'get_bytes()', as well as tests for it, though I chose not
to change get => get_bytes just yet. It has always returned a file-like
object, and it would be a lot of churn to change it to get_file. I can
do that upon request, though.

It also implements Transport.non_atomic_put_{bytes,file}. Which has 2
differences from just calling append_*.

1) On SFTP, they don't have to do a round trip to the server to find out
the file size, before they start writing data. This should help quite a
bit when pushing a branch that doesn't exist yet.

2) They add a new field 'create_parent_dir'. I don't use this yet, but I
need it for my changes to Knit, which delays creation until the first
data is written, rather than writing just a header. This should help to
avoid some of the round-trips of trying to create a file, failing,
mkdir, and then trying again. (Part of the problem with our Knit code,
is that each of those failures had to do another get() probe, as well as
an append(), which would probe again for the file size)

Finally, this makes Transport.append_multi() and Transport.put_multi()
functions deprecated. They weren't used anywhere except the test suite,
so it doesn't make sense to leave them around.

I'll be posting my updated 'reduce-knit-churn' patch, which uses the
non_atomic_* functions to really cut down the 'bzr push' time.

John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: transport_bytes.diff
Type: text/x-patch
Size: 86234 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060905/4d237e39/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060905/4d237e39/attachment.pgp 


More information about the bazaar mailing list