Mirror a bazaar repository from Launchpad to Github   October 12th, 2013

This is a summary of the thread in the OpenPetra Forum:  mirroring bzr to github

The goal is to get all the version history of lp:openpetraorg into a repository at Github.

I have started mirroring our bzr trunk to a github repository, mainly so that I can host private branches of my customers (including configuration etc) at Github (https://github.com/plans), which is cheaper than Launchpad commercial plans (https://launchpad.net/+tour/join-launchpad#commercial).

The initial checkout for git is much faster than bzr for some reason.

But it also has some benefits for the development team:
You can use the better history of files for example:
https://github.com/tpokorra/openpetragi … Service.cs
Bazaar messes up the history of a file quite badly by mentioning any merge that is related to a file by some means, which makes it very confusing.

I am using this script:
Blog Entry by Felipe Contreras about the bridge script
Source of git-remote-bzr.py

Here are the commands that I am using (on CentOS):

Get the script:

wget https://raw.github.com/felipec/git/fc/master/git-remote-bzr.py
chmod a+x git-remote-bzr.py
sudo mv git-remote-bzr.py /usr/bin/git-remote-bzr

install latest bzr:

sudo yum -y install gcc python-devel
wget https://launchpad.net/bzr/2.6/2.6.0/+download/bzr-2.6.0.tar.gz
tar xzf bzr-2.6.0.tar.gz
cd bzr-2.6.0
sudo python setup.py install
cd ..

install latest git:

sudo yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker
wget https://git-core.googlecode.com/files/git-1.8.4.tar.gz
tar xzf git-1.8.4.tar.gz
cd git-1.8.4
make prefix=/usr/local all
sudo make prefix=/usr/local install
cd ..

Initial clone:
Attention: the bazaar checkout will download about 4 GB of data (git will later only use about 250 MB!!!). The clone will need quite some memory, about 2 GB of RAM should be available. Therefore I usually do it in two steps, so if something goes wrong in the clone, I don’t need to download everything again!

git clone "bzr::lp:openpetraorg"


bzr checkout lp:openpetraorg
git clone "bzr::openpetraorg" openpetra

Push to github:

cd openpetra
git remote add github https://tpokorra@github.com/openpetra/openpetra.git
# or use if you want to use authentication with SSH key:
# git remote add github git@github.com:openpetra/openpetra.git
git push github master

new changes from bzr to git:

cd ~/openpetraorg
bzr update
cd ~/openpetra
git pull origin
git push github master --tags
Tags: , , , ,
This entry was posted on Saturday, October 12th, 2013 at 6:01 am and is filed under Software Development. You can follow any responses to this entry through the RSS 2.0 feed.Both comments and pings are currently closed.

No Responses