20/04/2009

SourceForge.net: Migrating from CVS to GIT...

As I have been planning for a long time to do this move, I will post here my experiences with one of my projects at sourceforge.net to migrate it from CVS to GIT... Here are the steps, and believe me, those seem to be the safe one (the logical ones didn't work as well as those):
  1. Backup your project:
  2. rsync -av rsync://jlibdc1394.cvs.sourceforge.net/cvsroot/jlibdc1394/* .
  3. Transfer one module to a svn repo:
    cvs2svn -s MODULE ../PLACE_YOU_DID_RSYNC/MODULE
  4. Install the svn2git:
    git clone git://github.com/jcoglan/svn2git.git
    rake gem
    sudo gem install pkg/svn2git-1.0.0.gem
    # On ubuntu you run it with /var/lib/gems/1.8/bin/svn2git file:///...
  5. For each module, you will create an empty directory and inside that directory run:
     /var/lib/gems/1.8/bin/svn2git file:///PATH_TO_MODULE
  6. Well, this gives you a bunch of modules, with their branches, if you had them. So, from here, your hell begins... Myself, I had 3 modules, that I checkout in branches. I did it in empty branches for each module:
    git symbolic-ref HEAD refs/heads/MODULE_NAME
    #removed everything from the old branch switch...
    rm .git/index
    git clean -fdx
    git pull PATH_TO_GIT_SVN_MODULE
    git push --all
  7. You can also move some remote branches, or move:
    git push origin origin/OLD:refs/heads/NEW
    # delete the old branch
    git push origin :OLD
  8. This should give you enough flexibility and people can still use those branches. Idealy, you should have super-project and sub-projects. But git is not that great on that yet... and the tools are also failing on this topic.
  9. You can see the results from here: http://jlibdc1394.git.sourceforge.net/git/gitweb.cgi?p=jlibdc1394
Post a Comment