This page appears to contain material that is no longer relevant. Please help improve this page by updating its content.
See RepositoryConversion for other conversion tools.
Tailor is a tool that supports conversion between a variety of systems.
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:
-D turns on debugging mode, printing each executed command. Good way to understand what Tailor is doing, but produces an invalid config file is used in the first tailor command above.
-v verbose, echo the changelogs as well as the commands being run (convenient for understanding progress)
Don't do the above process where /path/to/hg/ contains a cvs checkout in a directory with the same name as MODULENAME (as in, /path/to/hg/MODULENAME already exists). Weird things happen.
Tailor will only convert one branch at a time. If you have multiple branches in CVS, see TailorCVSBranches
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 Mercurial 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:email@example.com:/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.
Converting Large Or Complex Repositories
If you have a repository with some complex operations or which has many patches (i.e. thousands), you may find that it's better to add a couple of things to the process above:
- Chunked conversion of 200 patches at a time to make it faster
Use of the seperate subdirectory feature of tailor to deal with some of the complex cases. See http://progetti.arstecnica.it/tailor/wiki/DisjunctWorkingDirectories for information on this option
An appropriate configuration file would look like this:
[DEFAULT] verbose = True [project] start-revision = INITIAL state-file = tailor.state root-directory = /Volumes/GHC-Hg source = darcs:source target = hg:target patch-name-format = %(revision)s [hg:target] repository = /Volumes/GHC-Hg/ghc-head subdir = ghc-head-hg [darcs:source] repository = /Volumes/GHC-Hg/ghc-intermediary subdir = ghc-head-darcs
Where ghc-intermediary is a intermediate Darcs repository we will stage the patches in to, 200 at a time. Before you start, run these commands in the Tailor root-directory:
mkdir ghc-intermediary (cd ghc-intermediary; darcs init)
And then instead of invoking tailor, run a script with these contents (again, from the root-directory):
# while python -c "print 'y'*200+'d'" | (cd ghc-intermediary; darcs pull --quiet /Users/mbolingbroke/Programming/Checkouts/ghc.head) do tailor -c ghc-intermediary.tailor done
Obviously you should replace the path to ghc.head in this script with that to your own Darcs repository.