Thursday, November 3, 2016

My Experience Converting From CVS To Mercurial

At first I tried to directly convert from CVS to Mercurial using http://hg.gerg.ca/cvs2svn with the command:

./cvs2hg --encoding=cp1252 --hgrepos hgrepository /path/to/cvsrepository

but that only resulted in an empty directory.

In my next attempt I decided to convert from CVS to SVN and then from SVN to Mercurial. With that in mind, I used http://cvs2svn.tigris.org/ for the CVS to SVN portion.

I had an issue that led me to cleaning up some files in my CVS repository. This was mostly likely caused by a file being deleted in CVS and then being created again. This led to one file having two different histories. When running the CVS to SVN conversion I had to add the parameter --encoding=CP1252 due to how our source repository was encoded.

In the SVN to Mercurial conversion I used Mercurial's ConvertExtension. I also had to install Subversion's Python bindings: https://bitbucket.org/tortoisehg/thg/wiki/libsvn. After running "hg convert svnlocation" it succesfully generated a Mercurial repository with the history intact.

Going back to the original cvs2hg conversion, it turns out that what I thought was a empty directory was not in fact empty. The issue was that the OS was hiding the .hg directory from me so it actually did generate a Mercurial repository. This is good because the resulting history is better than the one I got from doing the CVS to SVN to Mercurial conversion.

From this point forward all I have left to do is pick and choose which projects I want to bring over and trim some of the branches that were carried over from the CVS repository.

No comments: