[MERGE] "Branch.open()" should re-use the connection for stacked branches

John Arbash Meinel john at arbash-meinel.com
Thu Jan 8 19:52:47 GMT 2009


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

John Arbash Meinel wrote:
> So in starting to use stacked branches, I noticed that just connecting
> to one causes us to open the connection multiple times. (Thanks to
> paramiko actually printing the connection each time.)
> 
> It turns out that doing "bzr push" to a new stacked branch actually
> connects at least 4 times. Pushing to an existing branch connects 2 times.
> 
> I managed to track down one of the places. We were calling BzrDir.open()
> without passing the current transport as a possible transport to re-use.
> 
> With this patch, 'bzr push' to an existing stacked branch only connects
> once, while pushing to a new stacked branch does still connect 2 times.
> But at least that is down from 4 times.
> 
> Also, in this patch I pulled out a lot of the common error handling in
> test_stacking. Basically, every test needs to catch the exception about
> not supporting stacking, and I pulled out some of the common code.
> 
> It is unfortunate that we have to spend the time creating 2 branches
> over an SFTP transport before we can get to the point of realizing they
> aren't stackable (TestCaseWithConnectionHookedTransport uses SFTP to
> actually track the number of connections). But it works.
> 
> John
> =:->

I tracked down the other places that were causing problems for 'bzr
push'. So now doing "bzr push lp:///~USER/bzr/new-branch" correctly only
connects one time. It still is far too slow (3min+ to push a stacked
branch with 1 revision), but that is because of other reasons. (Like
insert_record_stream using the stacked-on repository rather than the
source repository to convert a delta into a fulltext, which means we
download the delta chain, and then re-upload it as a fulltext.)

Anyway, I think this is a small enough improvement that we could
probably get it into 1.11.

For me, connecting to LP takes about 6s, so this patch shaves 6*3=18s
off of a 'bzr push'. And, of course, makes it less annoying, which is
the important part.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAklmWY8ACgkQJdeBCYSNAAPMugCgxFYqE+typLjGkNA7EvusJR5r
CpwAniu1S7zP9t4dEz1Eykm4xWotIAFC
=nlVp
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: stacking_tweaks.patch
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20090108/b5fabe5a/attachment-0001.diff 


More information about the bazaar mailing list