cheap branching across file systems?

Erik Bågfors zindar at gmail.com
Mon Jul 10 09:42:56 BST 2006


On 7/10/06, TK Soh <teekaysoh at gmail.com> wrote:
> On 6/28/06, John Arbash Meinel <john at arbash-meinel.com> wrote:
> > That is exactly that we can create cheap branches within a repository,
> > but only as subdirectories of the repository. The specific comment is
>
> What are the commands needed to create a cheap branch?

1) create a repo
2) create a branch in it
3) branch that branch :)

so,
1) bzr init-repo --trees repo
2) bzr branch http://bazaar-vcs.org/bzr/bzr.dev/ repo/bzr.dev
3) bzr branch repo/bzr.dev repo/bzr.fixes



> > that with repositories, bzr doesn't need hard-links to get the same
> > space savings.
>
> So, 'bzr branch' will create a complete duplicate of the repository,
> even with the same file system?

No, if you are using a shared repository (as in the example above) it
will use it, if not, it will create a new stand alone branch.

> > HG supports hard-linking their branches (though as you make changes to
> > one, it starts to break the links for anything that is effected).
> > But that means you have to be on a filesystem that supports it. (so no
> > vfat, HFS+ generally performs poorly, and not ftp...)
>
> Doesnt  bzr support hardlinking at all?

Not currently.  Someone will most likely implement it in the future.
But the shared repo strategy has many advantages over it anyway.

Take this example
You, me and John work on the same codebase, we each have one copy of
upstream and one copy of eachothers branches. In hg, it would look
like this

hg clone $upstream upstream
hg clone upstream erik   # This is hardlinked
hg clone $john john  # This is not hardlinked
hg clone $tk tk # This is not hardlinked

So, I have 4 branches, and they take up the space of 3

In bzr, we'd do
bzr init-repo --trees repo
cd repo
bzr branch $upstream upstream
bzr branch upstream erik   # Uses shared repo
bzr branch $john john  # Uses shared repo
bzr branch $tk tk # Uses shared repo

we now have 4 branches, and they take up little more the space of 1
(for the working dir, etc, use init-repo without --trees and it will
be smaller)

Regards,
Erik




More information about the bazaar mailing list