See RepositoryConversion for other conversion tools.

Tailor is a tool that supports conversion between a variety of systems. It's available at http://progetti.arstecnica.it/tailor.

Example Tailor conversion from CVS

This is tested with Mercurial 0.7 and Tailor 0.9.18. As of 2007-03-12, Mercurial 0.9.3 and tailor 0.9.26 don't play well together. The patches by John Goerzen allow conversion to complete (see below "Example Tailor conversion from Darcs" for information about getting John's patches), but the resulting repository has not been heavily used yet.

 mkdir -p /path/to/hg/repo
 cd /path/to/hg/repo
 tailor -v --source-kind cvs --target-kind hg --repository $REP --module MODULENAME -r INITIAL > MODULENAME.tailor
 vi MODULENAME.tailor

Now you will at least need to change subdir from . to MODULENAME, and remove /MODULENAME from root-directory in the MODULENAME.tailor file. You will probably also want to add the line:

 patch-name-format = %(revision)s

at the end of the "project" section to get your cvs checkin comments in the patch summaries. Type man tailor and search for patch-name-format to learn more about this. When done editing the config file type:

 tailor --configfile MODULENAME.tailor

When this is done, you should have a working Mercurial repository that matches the trunk of the CVS archive you have been using. The --repository option gets passed to CVS via the -d option, so anything that works for $CVSROOT will for for --repository.

Be aware that the last stage of this script will take a long time to run. Also, local access to the CVS repository instead of remote access may make it significantly faster.

Things to know:

Tailor config files

A very convenient way to use Tailor is through ini style config files. An example file like the following could be used to convert from a cvs repo to a hg one:

[DEFAULT]
patch-name-format = %(revision)s
verbose = True
encoding = iso-8859-15

[mutt_hg]
root-directory = /home/brendan/hg/mutt
source = cvs:source
target = hg:target

[cvs:source]
module = mutt
repository = :pserver:anonymous@myproject.server.net:/cvsroot/mutt/cvs

[hg:target]
encoding = utf-8

Example Tailor conversion from Darcs

You will need a very recent Tailor with the patches from John Goerzen in it before attempting this. These patches were integrated into the Tailor darcs repo on March 6, 2007. Your best bet at present is to download Tailor directly with darcs:

darcs get --partial http://darcs.arstecnica.it/tailor

A config file such as this works well:

[DEFAULT]

[project]
target = hg:target
root-directory = /home/jgoerzen/hg/missingh
state-file = missingh.state
source = darcs:source
start-revision = INITIAL
subdir = missingh
patch-name-format = %(revision)s

[hg:target]
repository = /home/jgoerzen/hg/missingh/missingh

[darcs:source]
repository = /home/jgoerzen/tree/missingh

I placed this file in /home/jgoerzen/hg/missingh/missingh.tailor. It will create a new Mercurial repository in /home/jgoerzen/hg/missingh/missingh, based on the Darcs repository in /home/jgoerzen/tree/missingh.

To run the process, simply use:

tailor -D -v --configfile missingh.tailor

Omit the -D and -v if it is too chatty for you.