Collocating repo and checkout

Parth Malwankar parth.malwankar at gmail.com
Mon Apr 6 15:14:37 BST 2009


On Mon, 06 Apr 2009 13:34:17 +0530, Michael Homer <michael at gobolinux.org>  
wrote:

> Hi,
> For my workflow I find git's in-repository branches handy, and I've been  
> wanting
> to make that same functionality work in Bazaar, which I otherwise  
> prefer. I've
> been looking at writing a plugin to duplicate at least the part of them  
> that I
> find useful. In the course of that I've found an odd trait that seems  
> very
> convenient, but also potentially dangerous.
>
> The usual multi-branch workflow for Bazaar is to have one shared  
> repository and
> several branches within it, possibly with one of those being a  
> lightweight
> checkout of one of the others. By copying the "branch" and "checkout"
> directories out of that checkout into $repo/.bzr it seems to be possible  
> to
> have Bazaar treat the root of the repository itself as the checkout. The
> treeless branches themselves can then be put somewhere out of the way,  
> such as
> .bzr/local-branches, and you end up with a pretty good approximation of a
> single multi-branch branch. Specifying the paths to switch and merge then
> becomes a pain, but that's where the plugin would wrap things up nicely.
>
> I have two questions to go with that: firstly, are there any potential  
> pitfalls
> in this setup? Clearly it's a pretty big hack, but as far as I can tell  
> from
> testing things out nothing in Bazaar has a problem with it. Both the  
> checkout
> and the repository go about their business in the ordinary way, without  
> any
> interference from each other. Secondly, since it's not an intentional
> behaviour, is it likely to continue working in the future (so I can base  
> my
> plugin around it)?
>

There was some work done on git style branch plugin earlier
http://article.gmane.org/gmane.comp.version-control.bazaar-ng.general/49511

I haven't tried it personally.

Regards,
Parth


> For clarity, here's a script of how I'm initialising this repository:
> bzr init-repo .
> mkdir -p .bzr/local-branches
> cd .bzr/local-branches
> bzr init trunk
> cd -
> bzr checkout --lightweight .bzr/local-branches/trunk sandbox
> cp -R sandbox/.bzr/{branch,checkout} .bzr
> rm -rf sandbox
>
> From that point on the root of the repository acts as a checkout, and  
> you can
> create new branches and switch between them without issue. It avoids  
> polluting
> .. with extra directories, which sometimes isn't an option for what I'm
> working on (such as live copies of scripts in the system). Storing the
> repository elsewhere and using a checkout live would also work, but  
> probably
> couldn't be wrapped up in a generic way.
> -Michael



-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/




More information about the bazaar mailing list