GitSVN

Using GIT with the Mono Subversion repository

Everything you need to track the Mono SVN repostory can be found on the GIT SVN tutorial (http://git.or.cz/course/svn.html).

There only issue is that it takes about two days to import the mono and mcs SVN trees into GIT. To simplify matters, we have set up a couple of bootstrap GIT repositories that contain a recent copy of SVN history. The howto below explains how to use that repository to speed up your initial import to around 20 minutes.

Remember that these are bootstrap repositories that are rarely updated, and are not meant for day-to-day tracking of the mono and mcs trees. You can use the normal git-svn commands

Initializing the svn import

First ensure that you have a recent Git (at least version 1.5.1). The initial steps are almost the same as any GitSVN import, but slightly more verbose. This shows the setup for tracking the mono/ tree from the developer's SVN repository

 mkdir mono
 cd mono
 git init
 git svn init svn+ssh://foo@mono-cvs.ximian.com/source
 git config svn-remote.svn.fetch trunk/mono:refs/remotes/git-svn/trunk
 git config svn-remote.svn.branches branches/*/mono:refs/remotes/git-svn/branches/*
 git config svn-remote.svn.tags tags/*/mono:refs/remotes/git-svn/tags/*

This will setup an empty Git tree with a GitSVN import source named git-svn. We now populate the tree from the bootstrap repository with:

 git fetch git://repo.or.cz/mono.git refs/heads/master:refs/remotes/git-svn/trunk refs/heads/branches/*:refs/remotes/git-svn/branches/* refs/tags/*:refs/remotes/git-svn/tags/*
 git reset --hard git-svn/trunk

You now have a full mirror of the mono/ SVN tree with all the history upto whenever the bootstrap was last updated. You can the top-up the repository with

 git svn rebase

The first run will regenerate some git-svn metadata.

You can repeat the same steps for the mcs, xsp, mod_mono, monodevelop and debugger trees, by replacing mono with mcs, xsp, mod_mono, monodevelop or mono-debugger in the instructions above.

A script to automate this is here.

Using the repository

If you want to work with the 2.0 branch, you can say

 git checkout git-svn/branches/mono-2-0
 git svn rebase

(Note that this creates a so-called detached HEAD, which should only be used for browsing the code, building, and committing cherry-picked patches: not for long term development.)

You can go back to the trunk with

 git checkout master

(Note the difference. 'master' is a local branch that we informally track git-svn/trunk with. 'master' can be used for long-term development.)

ChangeLog merger

To avoid conflicts in ChangeLog files when merging commits, use this ChangeLog merger (http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/git-merge-changelog.c).