2011-11-20

Migrating Gemini Management from SVN to Git

The Short Story


Finally the Gemini Management project has a Git repository. The SVN repository is used no more. You can use the following repository URLs to clone the project's code:
  • git://git.eclipse.org/gitroot/gemini.management/org.eclipse.gemini.managment.git
  • ssh://git.eclipse.org/gitroot/gemini.management/org.eclipse.gemini.managment.git
  • http://git.eclipse.org/gitroot/gemini.management/org.eclipse.gemini.managment.git
You can access the repository on the web here.

For those not interested in details, that's it. The more curious can keep on reading.


And Now The Long Story


From its inception, the Gemini Management project used to use a SVN repository. Exactly as all other Gemini projects do. Except Gemini Web, which switched to Git some time ago.

But things are changing. Now Git is the official revision control system for Eclipse and most projects migrate to it. I will not enter the endless polemics of which revision control system is better, or more powerful, or has better tooling and is more usable. The fact of real life is that in some point in time all Eclipse projects will change to use Git. And I myself prefer this point to be sooner than later. Because I find it rather annoying to use three different tools for three different revision control systems - I use CVS for Eclipse Orbit and Eclipse documentation, Git for Equinox projects and Virgo, and I used to use SVN for Gemini Management. That is why I decided to move Gemini Management to Git. Now I use one tool less :)

Migrating itself is very easy, actually. The Eclipse Webmaster creates the Git repository on the filesystem for you. Then you have to ssh to git.eclipse.org to initialize the new repository. Actually, in the general case you do not have rights to execute any command on this host, except initrepo. Finally you clone the empty repository on your local machine, copy the project sources in it, commit and push. This is all you have to do. But if you want to keep the history as well, it is a little bit more complicated.

I will tell you how I kept the history. I'm not a Git guru, probably there's a better and cleaner way to do it. But at least mine works fine. So, I initialized the repository the Webmaster had created on git.eclipse.org and cloned the empty repository locally. Then, I used git-svn to copy Gemini Management sources from the remote SVN repository to a new local git repository. Exactly how to do this you can find here. I created the authors file, created a new folder for the repo and executed

git svn init <svn_repo_url> --no-metadata
git config svn.authorsfile <path_to_authors_file>
git svn fetch

Now I had a new git repo containing everything from the SVN repo, including the history. I had to push this to the existing remote Git repo. So I copied the contents of the .git/config file from the empty Git project I have previously cloned to the real one. I also copied the .git/HEAD reference from the empty to the real. I removed the contents of .git/refs folder in the real project and copied the contents of .git/refs from the empty to the real. I also deleted .git/svn folder from the real project. Probably this copying was a kind of hack, but it worked. I git fetched, git pulled and then git pushed. And Voila! - the source code got to the remote git repo of Gemini Management. Then I git fetched and git pulled in the empty local project and I got the Gemini Management code along with the history in it. You can get it too from the URLs in the beginning of this post.

Няма коментари:

Публикуване на коментар