Today I've been busy converting the KMess svn repository to git. [for the uninitiated: both svn and git are tools to track changes in the source code of an application. KMess is a MSN Messenger client for KDE
]. The reasons for git are twofold:
- KDE is moving to git.
Instead of trying to move from sourceforge -> KDE extragear now, we can directly move to git.
- We seriously need better merge support now.
As we're working on KMess 2.1 a lot of refactoring will happen; to create a library of our protocol code, and provide a plugin API. This requires branches for large changes, while continiously merging the mainline. Git can do this.
Which brings me back to today. Since our repository is also organized like KDE (/trunk/projectname/...) using svn-all-fast-export (made by Thiago) was the natural choice. This tool uses a "rules" file to specify which project a given repository paths should go to. It also offers ways to filter out commits.
Turns out that last feature is useful for us too. While the repository may look clean from the outside, it's history has some curlpits. A few times branches were created from the wrong path, deleted again, and recreated with the correct path. These can be filtered out.
Installing svn-all-fast-export
There are no binaries for the the application, so you'll have to run:
git clone git://repo.or.cz/svn-all-fast-export.git
cd svn-all-fast-export
qmake fast-export2.pro
make
The devel packages for Qt, subversion and apr need to be installed. For openSUSE 11.1 I had to correct the file src/Makefile
afterwards because the path to apr include path wasn't /usr/include/apr-1.0
but/usr/include/apr-1
instead.
Using it
First, you'll have to create a rules file. There are plenty of examples in the "examples" folder for this.
The documentation of svn-all-fast-export is absent at the
moment - except for a few sample rule files. Fortunately the source code was quite readable, and it's Qt 4 application. Looking at the source,
I've learned:
- The option --identity-map=<file..> can be used to convert the svn accountnames to git's "full name <email>" format.
- The
options --resume-from and --max-rev can be used to continue at a given
part (e.g. after getting an error, you can write a rule for it, and
continue with that revision).
- The output directory for every sub-project (repository with git) needs to exist already, and it should be initialized with git init. Not doing this gives an "broken pipe" abort, and you'll find yourself looking through the source code to find out why.

The result of my day includes of a large rules file, and shell scripts to automate everything. I've stored it in our subversion repository in a separate trunk/svn-to-git project, so feel free to look around. I hope these scripts can help you too. One thing.. there is again no documentation.... Read the source 
Issues left open
There are a few issues I haven't been able to solve yet.
- A few sub projects were moved across the repository, which is split in separate git repositories (svn paths:
/trunk/libisf
-> /trunk/kmess/contrib/libisf
). Is there a way to preserve the history for this?
- The network-library branch was branched off
/trunk/
instead of /trunk/kmess/
, and moved afterwards to a different location. I've tried to mark both folders with /kmess/
appended as being part of the branch. Now I'm stuck with a network-library branch which lacks the base revision. Only the changed files can be found in the branch.
For these final issues I'd like to know: is there a way this can be solved?