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

Robert Collins robertc at robertcollins.net
Wed Sep 6 00:27:38 BST 2006


On Tue, 2006-09-05 at 17:56 -0500, John Arbash Meinel wrote:
> 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.

I realise its kindof late for this, but I find it a lot easier is
patches like this that add an API and also convert a bunch of callers to
have two, or even three diffs to review:

 - the new API
 - conversion of callers
 - deprecation [if not part of the conversion-of-callers diff].

-Rob (reviewing the patch now)

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060906/e99ac16a/attachment.pgp 


More information about the bazaar mailing list