[patch] bzr push only transfers necessary information

John Arbash Meinel john at arbash-meinel.com
Fri May 19 14:39:20 BST 2006

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())


-------------- 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/20060519/26bd4d26/attachment.pgp 

More information about the bazaar mailing list