Sharing repository across branches (was: What do I call a working tree that stores its revisions in a shared repository?)
jw+debian at jameswestby.net
Mon Mar 31 18:05:59 BST 2008
On Mon, 2008-03-31 at 12:38 -0400, Stefan Monnier wrote:
> > So it seems to me that the far more common physical object probably
> > ought to be a working tree using a shared repository, both for
> > performance and disk usage reasons - but there's no simple name for
> That reminds me:
> 1 - I couldn't find any info about the impact of sharing a repository
> between unrelated branches. It is recommended to share repositories
> between branches, but it's not clear how to define "related
> branches", and it's even less clear what happens if I create
> a single repository in my $HOME and use it for every branch.
There's no real problem with doing it, and indeed some people do
just use one repository.
There are two things that may stop you though.
1. Creating and deleting lots of branches that are thrown away
completely, without merging them to a branch that remains in
the repo will make the size continue to grow. There is no
garbage collection command to clean this up yet.
2. It restricts the formats that you can use. If you work
on two projects which use different repository formats
and they may well not play well together. If they are
completely incompatible then they will just refuse to
share the same repo. Another bad case would be using
a knits repo with a packs upstream, as every pull from
upstream would have to do the expensive re-annotation.
> 2 - Say I have a branch with its own repository and I want to create
> another branch and share the repository. How can I do that?
> Is there a way to move a branch's repository up the tree (or move
> the branch down without moving the repository), or do I have to
> do it the expensive way (which recreates a completely new
> repository from the existing one)?
No, there's currently no way of doing this. "reconfigure" would
be the place to do it.
However, the discussion is over how it should be done, as you need
to either keep the repository where it is and move the branch down,
or move the repository up. Each of them have their problematic
cases to deal with.
Would you like me to explain how to do this by hand?
> 3 - Assuming number 2 can be solved satisfactorily, wouldn't make sense
> for "bzr clone" to suggest "move repository to closest common
> parent?" when needed so as to share the repository.
Yes, that may be nice to have, but again there are edge cases to catch.
When 2 is done then you could propose this again.
More information about the bazaar