A while back, I decided I wanted to switch one of my projects to a public repository. Something with a bug-tracker, a comment system, and that kind of stuff. I also wanted to use a distributed version control system to make myself learn these new beasts. I was torn between git and bazaar. Then I ran into Brian Aker‘s post on forking Drizzle: http://krow.livejournal.com/602409.html. The point was not to get focused on if git or bazaar was better; but on the surrounding infrastructure. So I put two of my projects on LaunchPad: matlab-bgl and libbvg.
Turns out he was right about the infrastructure. It’s just that LaunchPad is a really bad infrastructure for a tool developed by mostly one person. I realized that I just wasn’t pushing changes to these projects because launchpad was always really slow, and I didn’t really need any of its features.
However, I’ve frequently been using my GitHub repositories. And so, a few years in, I wanted to port my repositories to GitHub instead.
Wow! Was this much easier than I expected.
At first, I thought it’d be a nightmare. If you search for “converting bazaar to git” you’ll get some pages with nasty tailor configurations. For example:
http://bryan-murdock.blogspot.com/2007/07/how-to-convert-bazaar-repo-to-git.html
After trying those techniques, I realized it didn’t port my branches at all. Yuck, I want those branches! After reading about how to convert branches, I found this link:
http://blogs.igalia.com/aperez/2008/11/convert-repositories-with-fast-exportimport/
That link was wickly simple compared to the stuff using tailor. Within minutes I had git repositories up with all branches intact! A few notes: you don’t have to install fast-export via the plugin mechanism anymore. Ubuntu has it built in.
sudo apt-get install bzr-fastexport alias bzrexp="bzr fast-export" mkdir matlab-bgl.git cd matlab-bgl.git git init --bare bzrexp --export-marks=../marks.bzr ~/dev/matlab-bgl/master \ | git fast-import --export-marks=../marks.git bzrexp --marks=../marks.bzr --git-branch=4.0 \ ~/dev/matlab-bgl/4.0 | git fast-import \ --import-marks=../marks.git --export-marks=../marks.git bzrexp --marks=../marks.bzr --git-branch=4.0-octave \ ~/dev/matlab-bgl/4.0-octave | git fast-import \ --import-marks=../marks.git --export-marks=../marks.git bzrexp --marks=../marks.bzr --git-branch=work \ ~/dev/matlab-bgl/work| git fast-import \ --import-marks=../marks.git --export-marks=../marks.git git remote add <github repo location> git push --all # push all branches
It turns out searching for “convert bzr to git” is much more fruitful than “convert bazaar to git”. Hence, I’m naming this post “convert bazaar to git”
Now both of the projects are happily hosted on github with their history and branches intact!
Hi!
Its funny, I hear people say that the connection to launchpad is slow, but I never seem to experience this myself. My work flow has me always keeping trees around locally to clone from so I rarely clone off of Launchpad.
push() is never the slowest part of my workflow so I don’t really pay much attention to it. Compile/test is always what takes a bunch of time for me.
Cheers,
-Brian
> sudo apt-get install bzr-fastexport
Sure? Did you mean
sudo apt-get install bzr-fastimport
Pingback: YomGuy's Blog - Telemeta project now uses Git for development
Thanks for posting a solution to this problem. I was able to get it to work but by using ‘git init’ rather than ‘git init –bare’ … when does one need the ‘–bare’ option? Also – as a last step I had to run a ‘git checkout master’ in the new repository to get all the files to appear.
You don’t /need/ the –bare option, but it significantly speeds things up because git doesn’t have to bother updating files in the working tree. These operations can be done purely on the repository, which is why they’re really fast in a bare repository.
Thanks! Interestingly, I found it through “bzr to git” 😉
Pingback: Migrating from Bzr to Git (Single branch) « Short circuited tux_440volts !!
Looks like iFred is correct: “sudo yum install bzr-fastimport” worked for me on Fedora 18.
i have to admit. its a shame that there is such a “fight” between two good systems. Anyway, evolution will remove bzr soon.
The following worked for me directly in Ubuntu 12.10:
$ mkdir website.git
$ cd website.git
$ bzr init –format=git
$ cd ../bazaar-website/
$ bzr dpush ../website.git
Using bzr log in the Bazaar repo and git log in the Git repo produced the equivalent output for each DVCS.
Of course my way didn’t require various branches to be moved. The orignal process above was more to get branches moved over as well. My way was just a simple move to work with git. With dpush, you get ” Push into a different VCS without any custom bzr metadata.” (http://doc.bazaar.canonical.com/beta/en/user-reference/dpush-help.html)
There’s also a contrib setup for adding a bazaar (or hg) repo as a remote — pretty neat stuff!
http://felipec.wordpress.com/2012/11/13/git-remote-hg-bzr-2/
This tutorial didn’t work for me, check out this one.. it was a breeze: http://astrofloyd.wordpress.com/2012/09/06/convert-bzr-to-git/ !