Mobicents Diameter has a new home.. powered by git!

Wednesday, July 4, 2012 em 01:12
Due to the increasingly number and complexity of sub-projects, Mobicents has been splitting it's projects under independent project homes.

We are now at a transition stage, where each project lead will migrate his project at the appropriate time. For Diameter, after our major release (1.4.0.FINAL), it seemed the best time to do this migration.

The new home of the Mobicents Diameter project is located at http://code.google.com/p/jdiameter/. Feel free to visit us!

With this change, we have also taken the chance to move to a "better" and more powerful version control system, so we have changed from SVN to Git. We hope this will ease the contributions, which have been happening more often, thanks to out thriving community!

Despite being a allegedly better VCS, Git also has it's own shortcomings, such as not being able to checkout a single folder. The lack of this feature has impacted our structure, since it makes it impossible to independently release sub-components in the same Git repository.

While digging for a solution, I've came across the "sparse checkout" feature. While this may work for checking out only some folder(s), it is not supported by maven release plugin, thus not fixing the main problem. Another possible (and probably more correct) solution would be to use the "sub-repository" approach, where we'd split the components into different sub-repositories.

We actually did this on a first phase, but after realizing the big changes it would imply and being aware that google code messes with the automatic revision links (http://code.google.com/p/support/issues/detail?id=3245) we have decided to revert back to the single repository approach and abdicate from the release independency for each component. We have barely used it, anyway. The only exception is for the Jopr RHQ Plugin, so it got it's own sub-repository.

As a reference for someone going through the same process of moving from a [googlecode] SVN repository to a [googlecode] git repository, I'll leave a summary of the commands used for the move (please keep in mind that I'm totally new to git, so these may not be the optimal way, feel free to comment):

0. (optional) Since SVN only lists the username and git uses the email as well, the migration will cause weird authors such as "brainslog <brainslog@bf0df8d0-2c1f-0410-b170-bd30377b63dc>" it may be good to sanitize the authors. For that I've used the following script in the SVN repository:
svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors.txt

And then I've fixed the outcome in authors.txt to the correct: username = Full Name .

1. Clone the new (and probably empty) repository
git clone https://@code.google.com/p/jdiameter/ git-jdiameter

2. Clone from SVN (with authors fixed) to the cloned git repository, with full history, tags and branches
git svn clone -A authors.txt -Ttrunk/servers/diameter -ttags/servers/diameter -bbranches/servers/diameter https://mobicents.googlecode.com/svn git-jdiameter

Where -A points to the authors file, -T to the trunk of the SVN repository, -t to the tags and -b to the branches. Use only what you need, I didn't needed the branches part as we don't have any.

3. Enter the local git repository
cd git-jdiameter

4. Push!
git push --all

5. Create the git tags from SVN tags (I know this can be automatized but I needed to make some customizations to existing tags, as not all were correct)
git tag "1.0.0.BETA1" "refs/remotes/tags/jdiameter-1.0.0.BETA1"
...
git tag "1.0.0.FINAL" "refs/remotes/tags/1.0.0.FINAL"

6. Push.. again!
git push --tags

These are the 7 magical steps! In case that you don't care about history, simply do a "svn export --force http://mobicents.googlecode.com/svn/trunk/servers/diameter/ git-jdiameter" and push it, nothing else. Also, as mentioned, I did not had branches but I suppose they'd make it in the #4 push.

Mobicents Diameter users working with trunk master, must now switch to this new repository as the SVN will not be updated anymore! Do a "git clone https://code.google.com/p/jdiameter/" and hack away!

2 comentários

  1. Anonymous Says:

    I'm looking for a new home builder. But when I searching in the internet I found your blog. And I can say It your blog really interesting, that's why I read it. So keep on sharing! Anyway Not convinced? Find out more KB Homes here.

  2. thank,s

Post a Comment