[patch] bzr push only transfers necessary information

Robert Collins robertc at robertcollins.net
Sat May 20 11:43:23 BST 2006


On Fri, 2006-05-19 at 08:39 -0500, John Arbash Meinel wrote:
> Right now, if you have a local repository, and you push one of your
> branches out of it, it copies all of the history. On the other hand 'bzr
> branch' only copies the history necessary to reproduce the current revision.
> 
> To prove this, I did the following:
> 
> bzr init-repo --trees ~/dev/bzr
> cd ~/dev/bzr
> bzr get http://bazaar-vcs.org/bzr/bzr.dev/
> # This fills the repository with ~28M of history
> 
> cd ..
> bzr init test
> cd test
> echo a > a
> bzr add
> bzr commit -m a
> cd ~/dev
> 
> # This creates a small standalone project
> bzr branch bzr/test other-test
> du -ksh other-test # ~84k not 28M
> 
> # This copies everything
> cd bzr/test
> bzr push ~/dev/push-test
> du -ksh ~/dev/push-test # ~28M
> 
> I dug deeper, and it is because 'bzr push' doesn't use a revision-id, so
> it has no information about what history needs to be pushed (and thus
> pushes everything).
> 
> This patch fixes the behavior:
> === modified file 'bzrlib/builtins.py'
> --- bzrlib/builtins.py
> +++ bzrlib/builtins.py
> @@ -517,7 +517,8 @@
>                          if new_transport.base == transport.base:
>                              raise BzrCommandError("Could not create "
>                                                    "path prefix.")
> -            dir_to = br_from.bzrdir.clone(location)
> +            dir_to = br_from.bzrdir.clone(location,
> +                revision_id=br_from.last_revision())
>              br_to = dir_to.open_branch()
>              count = len(br_to.revision_history())
>          else:

I know it seems minor, but I think this needs a test, its the sort of
thing where a regression is quite significant.

Rob

-- 
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/20060520/9d2ab144/attachment.pgp 


More information about the bazaar mailing list