I’ve been spending a bit of time over the last few weeks managing source code repositories, specifically exporting things from CVS and importing into other systems (subversion and mercurial). I thought I’d document my experiences in case anyone else finds themselves in the same situation.
Export from CVS
The first step in the process is to obtain a local copy of the cvs repository you want to export (that’s the entire repository, not just a check-out. For FS, I used WinSCP to copy the entire /data directory from fsroma to my local machine. This takes a while.)
Once you have a local copy of the repo, acquire cvs2svn from here. This is a little utility that reads the cvs history from the repo and sequentially checks it into a subversion repo. This tool has a few useful features, such as the ability to create a new subversion repo, check into a given subfolder in the svn, etc. Because I like to be cautious, we’ll be making a dump file instead of checking directly into the subversion, although you are welcome to try this feature if you like.
From a command line, run:
./cvs2svn --dumpfile=cvs.dump /path/to/cvs/repo
where /path/to/cvs/repo is the path to your local copy of the cvs repository, and cvs.dump is the desired name of the dumpfile. Depending on the amount of history in your project, this can take an extremely long time (I left mine to go overnight while chewing on a few gigs of CVS data). When it’s done, you’ll have a big file called cvs.dump (or whatever you called your dumpfile).
Import into Subversion
If you don’t already have a subversion repository to import into, create one:
mkdir mysvn svnadmin create mysvn
Using the standard svnadmin utility, import the dump into your repository:
cd mysvn svnadmin load .< /path/to/cvs.dump
This will load the exported contents of the cvs into the subversion repo, at the root level. For finer control over the import process, see the svnadmin man pages.
Detailed instructions of these two steps (cvs export and svn import) can be found at http://articles.techrepublic.com.com/5100-10878_11-5933396.html
Import into Mercurial
The best way, that I have found, to get data from cvs and into hg is to go through svn. Mercurial has an extension called ‘convert’ that is able to convert many types of repositories into other types, but the cvs support doesn’t work so well.
Follow the steps above for exporting out of cvs into a subversion dumpfile, and import into a subversion repository. Next, use hg convert to import the subversion data into mercurial:
hg convert file:///path/to/svn/repo
This will create a new mercurial repository named mysvn-hg (if you named your svn repo ‘mysvn’). You can then clone this to anywhere you’d like. You can begin serving this in http :
hg serve -p 8000
Detailed information about hg convert can be found here