Thursday, February 07, 2008

CVS to Mercurial

This week I finally tried out Mercurial.
Having used only CVS before, I found this VCS simply amazing.
It's really simple to use and also to learn. Useless to say I decided
to move all my projects from CVS to mercurial.

After searching a while on the net I found some alternatives:
Mercurial ConvertExtension is shipped with mercurial 0.95 so I decided to
use this but probably Tailor is the most flexible of all. Surely it deserve
a try.

Anyhow, the documentation on the ConvertExtension wiki page is just non
existent and the online help of mercurial does not helped me a lot.

So here's how to convert a CVS module:

First of all checkout the module you want to convert as usual.
Let's say myproject is the checked out module, then do the following in
the directory containing the module:

$ hg convert myproject/
assuming destination myproject-hg
initializing destination myproject-hg repository
connecting to :ext:user@cvs.example.com:/cvsroot
scanning source...
sorting...
converting...


Now mercurial convert CVS commits to changesets and in the end it creates
a .hgtags file containing the mapping between CVS releases and mercurial
changesets.

Here it is. Now your module is ready to be used with mercurial. Just to see
if all is ok:
$ cd myproject-hg
$ hg log
And you should see all you CVS history.

2 comments:

MYSPACE said...

We are planning to move to Mercurial. Is there a way to pull or push a module using mercurial?

MYSPACE said...

what is the advantage of moving from CVS to Mercurial?

How you are convinced?