Friday, March 16, 2007

CVS to Mercurial

I decided to convert my simple .emacs cvs repository to mercurial. The instructions for converting repositories on the mercurial wiki were a little confusing, but here’s what I got to work on my Ubuntu Edgy Eft box:

aptitude install mercurial
aptitude install tailor

Then, in the directory where I wanted my mercurial repository (make sure there isn’t a cvs checkout of the module you are converting there!):

mkdir hg-temp
cd hg-temp
tailor -v --source-kind cvs --target-kind hg --repository /home/bryan/cvsrepositories/dot-emacs --module dot-emacs -r INITIAL > dot-emacs.tailor
emacs dot-emacs.tailor

In the dot-emacs.tailor file, change subdir from . to MODULENAME (which is dot-emacs, in my case), and remove /MODULENAME from root-directory, like the wiki says. Then add the line:

patch-name-format =

at the end of the “project” section1. Then:

tailor --configfile dot-emacs.tailor

This creates three files, tailor.state.old, tailor.state, and project.log2 in the parent directory, as well as a directory called, dot-emacs. This new directory is your hg repository. Change to that directory and type hg log, and then hg log -v to see the preserved cvs history and checkin comments.


1 At least, that’s what I liked best, ‘man tailor’ and search for ‘patch-name-format’ for more info on this.

2 As far as I know you can blow these files away when you’re done.

No comments: