After reading and watching a lot of git I want to give it a try. I used Bazaar-ng (bzr) for some time now, but just for my own, small projects. I searched the internet to find a way to convert my project and don't loose the history. I stumbled upon bzr-fastimport in which a bzr-fast-export.py exists in the export directory. But nowhere was a word about what to do with it.
First of all you need to go into the top level of your bzr working tree and make it a git repository.
$ git init
That's the easy part. Now you have to add all the files you had under bzr control.
$ git add file1 file2 dir1 dir2
I did this individually as not all the files in the directory should be under revision control. You could just say
$ git add .
to add all files under the current directory (except .git). But I guess this will even add the .bzr directory what you not want.
After this the interesting part, getting the old history. (I assume you named your bzr repository foo.)
$ /some/path/bzr-fast-export.py foo | git-fast-import
And finally commiting it
$ git commit -m "import of old bzr repo"
This worked for me, hope it works for you, too.
Your add and commit lines are
Your add and commit lines are not necassery.
Just do:
git init project.git
cd project.git
bzr-fast-export.py --export-marks=.git/bzr.mark ~/project.bzr | git-fast-import --export-marks=.git/git.mark
This schould convert everything
"git checkout master" to get the working copy (what you wanted to achieve, with your git add?)
Now you can incremental import new bzr changes with:
bzr-fast-export.py --import-marks=.git/bzr.mark --export-marks=.git/bzr.mark project.bzr/trunk | git fast-import --import-marks=.git/git.mark --export-marks=.git/git.mark
Hoped that helped
Thanks for this! @David:
Thanks for this!
@David: your incremental command does not work - it appears bzr.mark and git.mark have not been created at first, and git throws a fatal error when it cannot read the import-marks file.
btw: since it's a bzr plugin (by now), you should call bzr-fast-export as in "bzr fast-export".
Sorry, it appears I got the
Sorry, it appears I got the file names wrong.. after a new initial run, I have "bzr.marks" and "git.mark".
Additionally, "bzr fast-export" supports using one option ("--marks") for specifying a mark file for import and export.