Migrating to Mercurial

I have been wrestling with converting my old source code projects to a modern source control system and in some cases source control at all. At one point, I tried using a converter from CVS to Subversion, with lousy results. Fast-forward to today, where, armed with a new installation of Mercurial and some experience working with Mercurial transferring bin folder from machine to machine, I felt ready to give it another go.

First Google. I found that the latest Mercurial (TortoiseHg) has built-in support for conversions from many popular source control systems. The trick error was turning it on as by default the conversion plug-ins are not active. So I opened global options in TortoiseHg and activate the convert plug-in. this modifies the mercurial.ini/.hgrc file with the correct settings and then the command line hg convert returns conversion options.

The CVS conversion requires a checked out repository, not the source CVS files. So my first problem was checking out the repository which had not been refreshed from a recent disc crash. on the new machine I did not have CVS, so I had to upgrade Cygwin setup, then add the CVS command line client. I use after struggling with the Windows tortoise CVS checkout and the Windows CVS checkout, I open the seat Cygwin bash shell and performed the check out there.

First I was able to look in the D:\Data\cvsrepos\ dir and get the list of modules. The first was the dev module.

In bash:
$ export CVSROOT=:local:/cygdrive/d/data/cvsrepos
$ cvs co dev

> hg init
> hg convert -s cvs -d hg C:\cygwin\home\Dave\cvsco\dev
assuming destination dev-hg
initializing destination dev-hg repository
connecting to :local:/cygdrive/d/data/cvsrepos
scanning source...
collecting CVS rlog
100 CDCompare/FileItem.cpp
200 CDCompare/winsub/res/winsub.ico
300 PSA/PSAPrint/res/PSAPrint.ico
2953 log entries
creating changesets
100 This is work done on a branch from the original code. I think I was tryin...
200 update from p2.1.dll.all.zip
205 changeset entries
204 Source for CDCompare project
203 Add CancelDlg module
C:\Users\Dave\cvsco> 1 [main] cvs 6128 C:\cygwin\bin\cvs.exe: *** fatal err
or - cmalloc would have returned NULL
Stack trace:
Frame Function Args
0022B4F8 6102749B (0022B4F8, 00000000, 00000000, 00000080)
0022B7E8 6102749B (61177B80, 00008000, 00000000, 61179977)
0022CC08 61116E6A (00000000, 00000000, 0022CD18, 610C01A5)
0022CC18 61004C8B (00000000, 10438204, 00000001, 0048C300)
End of stack trace (more stack frames may be present)

Let me just say aargh here…I seem to remember trying this before and getting the same result. I also remember firing up a Linux VM, copying the repository, checking out there, and then trying the conversion. Of course, I don’t know where the repository is so I think I might get to do it all over again. No wonder I never can finish anything. It’s so hard to get there from here.

Anyway, fire up ubuntu. Start small. Share the cvsrepos folder on the Windows side, connect via “Connect to Server…” on Ubuntu to the SMB by IP. Now what is the CVSROOT? When you attach to an SMB server, where is it mounted. Sensibly, in Mac OSX, /Volumes/sharename. Here, found by dragging link from FileBrowser onto terminal, and it coughed up a link.
$ export CVSROOT='/home/dave/.gvfs/cvsrepos on'
$ cvs co lib
$ hg convert -s cvs -d hg ./lib
$ cd lib-hg/
$ hg push http://provider.org/username/lib

Repeat five more times. I am now done with CVS.

This entry was posted in Computers, howto and tagged , , , , . Bookmark the permalink.

Leave a Reply