Collocating repo and checkout

Aaron Bentley aaron at aaronbentley.com
Mon Apr 6 15:31:23 BST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michael Homer 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 have two questions to go with that: firstly, are there any potential pitfalls 
> in this setup?

I'm not aware of any.  Personally, I find a single checkout to be too
limiting, but clearly, it works for you.


> Clearly it's a pretty big hack

You can use bzr reconfigure to do it without any hackery.

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

Yes, it will continue to work.  Changing the way we handle that would be
a big deal.  If you want to be extra certain, submit a test case to
bzr.dev :-)

> 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

You should be able to just do
bzr init-repo .
bzr init --create-prefix .bzr/local-branches/trunk
bzr reconfigure --lightweight-checkout --bind-to \
   .bzr/local-branches/trunk

> 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.

I don't know about that-- it's my usual workflow.  See the 'cbranch'
command in bzrtools, for example.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAknaEjgACgkQ0F+nu1YWqI1UPACeJa+ivRWzQ5ppdJn/MrT77Ztc
+XIAn3p7XTGzqv7YFomTOkECISIGUnUU
=yGJ1
-----END PGP SIGNATURE-----



More information about the bazaar mailing list