Estimated read time: 2 minutes
It seems recently one of my favorite topics is 'how to convert from $random SCM to git' ;)
So, I already had a configuration using tailor, but that was slow. I know this already. Tailor is good because it always works, it isn't good because it's fast.
First, you need git-1.6.0rc0 or higher, you can find an fpm in my bmf repo.
Second, you need the bzr fastimport plugin:
bzr branch lp:bzr-fastimport
Then enable the plugin:
cd ~/.bzr/plugins; ln -s /path/to/bzr-fastimport fastimport
Now you can clone git-bzr itself:
git clone git://github.com/pieter/git-bzr.git
Put it to your PATH:
cd ~/bin; ln -s /path/to/git-bzr/git-bzr .
NOTE: so you should not symlink the dir, but the script inside the dir.
Okay, this is done, now clone (branch in bzr terms) the bzr repo you want to convert. For example:
bzr branch http://code.bitlbee.org/bitlbee/
Finally do the conversion (from the git-bzr README):
git bzr add upstream ../bzr-branch git bzr fetch upstream git checkout -b local_branch bzr/upstream : hack hack hack git bzr push upstream
Actually for now I only needed a one-directional convert, so my update-bitlbee.sh now looks like:
cd ~/scm/bzr/bitlbee bzr pull cd - # so we are again under bitlbee.git, it works in bare repos as well! git bzr fetch upstream
And yes, the resulting trees match perfectly! ;)
(Yes, I plan to package git-bzr and bzr-fastimport but I want to give it a good testing first.)