From svn to git, handling non-standard repo layouts

Today I finally had to “extract” a project from one of our biggest repos as part of a git migration plan. I’ve converted most of the other smaller projects in the same repo over using just their trunk, and it has worked without any noticeable issues. Now the project in question has several active branches and important tags. Our repo layout is something to be a shamed of, and git-svn likes “standard” subversion layouts.

I found this thread on KernelTrap, where one user has a similair layout to ours and faced the exact same predicament. The thread is interesting, and the people offer some good tips and advice. Although most of them just seemed “wrong”.

I proceeded to get a copy of our live repo onto my laptop for a simple test. Using a quick svnadmin dump/load combo I had a copy to play with. I sat with a team member, and several svn manipulations later we had restructured that project’s layout to be more svn-like. I then commenced to use the standard git-svn import tool and it pulled in all the branches, tags and trunk for the project in without breaking a sweat.

So, importing from svn with full history from a non-standard repo layout isn’t a daunting task after all.

Just one friendly warning though, if possible, get rid of as many unused branches and tags as possible before importing into git. The full history can get very messy in some cases, and in others a clean slate will be welcomed by the team…

Hope this helps someone else to jump ship easily :)

Welcome to the Open Sourcery Archives. These are my older blog posts, from days gone by. I'm keeping them up as part of the historical record. That, and I'm strangely sentimental about them. Please keep in mind that things most certainly have changed since these articles were written, links to external sites might be broken, and general thinking might have changed.

Regardless of all this, I hope you enjoy your stay!

comments powered by Disqus