Friday, December 2, 2011

Migrating project from BerliOS to GitHub

BerliOS, the open source software forge, announced ending of its life by Dec 31, 2011. Although some time later, there was another announcement that the service will continue, to be operated by a non-profit foundation, I thought anyhow of copying two projects I had there to GitHub.

The two small projects I wrote long time ago, while being a researcher at Franhofer Fokus, were not really maintained, but anyhow it would be a pity to lose the code, parts of it may be useful in the future. If anyone wanders, here is short the description of these projects:
  • pocketsipmsg - this project was used a lot durin 2002-2005 to make demos of SIP instant messaging using iPaq running Windows CE. It is basically a SIP user agent capable of sending and receiving text messages, developed in Visual C for Windows CE
  • tmrec - this project offers a C library and command line tool for matching time recurrences defined by iCal RFC2445. The code is actually used, being embedded in cpl-c module of Kamailio SIP Server
Initially they were stored in CVS repository of BerliOS, but I switched them to SVN some time ago. Therefore, I was looking how to migrate SVN repository from BerliOS to a GIT repository on GitHub.

Googling gave lot of useful tutorials about migrating SVN to GIT, I am writing here just to show the specific case of migration from BerliOS to GitHub - it could save time for some people interested in same kind of operation.

Personally I used a Mac OS X, so first I installed git-svn from ports:

# port -v -d install git-core +svn

On a Debian/Ubuntu, the command should be:

# apt-get install git-svn

You have to create a file to map BerliOS username (used for SVN commits) to name and email address (to be used by Git). I named it authors.txt, the content:

dcm = Daniel-Constantin Mierla <me@xyz.com>
(no author) = Daniel-Constantin Mierla <me@xyz.com>
root = Daniel-Constantin Mierla <me@xyz.com>

For some reasons, which I didn't want to spend time to investigate why, there were two other authors appearing to have committed in SVN: root and (no author) -- so simply I mapped them to myself as well.

Next step I used git svn to clone the berlios project - here is the command used for pocketsipmsg project:

# git svn clone http://svn.berlios.de/svnroot/repos/pocketsipmsg --no-metadata -A authors.txt -t tags -b branches -T trunk pocketsipmsg

You will have to replace pocketsipmsg with your project ID on BerliOS.

I wanted to get the tags and branches from SVN. In the cloned directory, pocketsipmsg, you can list the branches with:

# git branch -r

You will notice that the SVN tags are now branches, to get them back to tags, you have to execute for each tag (named next as $tagname):

# git tag $tagname tags/$tagname
# git branch -r -d tags/$tagname

On GitHub you have to create the repository for storing the project - see http://help.github.com/create-a-repo/ to learn how to do it, if you haven't done it yet. In my case, I named it also pocketsipmsg.

Then add GitHub as remote repository and push to it:

# git remote add origin git@github.com:miconda/pocketsipmsg.git
# git push origin master --tags

That's all, your project is now stored on GitHub!

In summary, if git-svn is installed, your project does not have tags, you created authors file and added the repository $PROJECTNAME on GitHub under user $USERID, the commands you have to run for migration of $PROJECTNAME from BerliOS to GitHub are:

# git svn clone http://svn.berlios.de/svnroot/repos/$PROJECTNAME --no-metadata -A authors.txt -t tags -b branches -T trunk $PROJECTNAME
# cd $PROJECTNAME
# git remote add origin git@github.com:$USERID/$PROJECTNAME.git
# git push origin master

Enjoy!

No comments:

Post a Comment