Differences between revisions 19 and 33 (spanning 14 versions)
Revision 19 as of 2006-05-10 11:09:44
Size: 4485
Editor: DavidMentre
Comment: d.: add link to another tla->hg conversion script
Revision 33 as of 2009-05-19 19:31:05
Size: 32
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
== Converting from other SCM formats to Mercurial ==

See http://www.darcs.net/DarcsWiki/Tailor for a tool that handles several popular formats.

=== Example Tailor conversion from CVS ===

This is tested with Mercurial 0.7 and Tailor 0.9.18

Things to know:
 * {{{-D}}} turns on debugging mode, printing each executed command. Good way to understand what Tailor is doing
 * {{{-v}}} verbose, echo the changelogs as well as the commmands being run (convenient for understanding progress)

{{{
 mkdir -p /path/to/hg/repo
 cd /path/to/hg
 tailor -D -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}}}. You will probably also want to set {{{patch-name-format =}}}; otherwise the summaries will have only redundant information in them.
{{{
 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.

See http://nautilus.homeip.net/~lele/projects/tailor/README.html#config-file-format and look at the second example, which shows a configuration sample converting from a CVS source to a Mercurial target. See also http://www.darcs.net/DarcsWiki/Tailor/VersionOne for a trace back of the changes.

=== From Arch 1.x/baz 1.5 to Mercurial ===

SamTardieu wrote a script to convert from Arch 1.0 archive format and I
enhanced it to write full changelog instead of just the summary. You can
find it on http://archives.keltia.net/hg/hg-convert. You need baz 1.5 because
the option to get the full changelog is different in 1.4 and more important, the format of the changelog is different. -- OllivierRobert

attachment:arch-to-hg.py -- I also hacked it to support baz 1.1.1 and tla 1.3-1 (and should also work for other versions, as it only uses some very simple commands). I tuned it to run much faster by just updating the same tree one patch after another. It uses UTC currently. Please try to keep it compatible and do not require latest versions if it can be avoided. -- ThomasWaldmann [[DateTime(2005-11-13T19:31:57Z)]]

[http://www.linux-france.org/~dmentre/misc/tla-to-hg-hist.py tla-to-hg-hist.py] -- I extended above script to import the full history of a revision (using tla's ancestry-graph command). -- DavidMentre [[DateTime(2006-05-10T11:15:00Z)]]

=== From Perforce to Mercurial ===

This utility can actually keep two repositories in sync.

Currently, it's slapped together and built to serve my particular needs, but it could probably be modified into something more general. It currently makes no attempt to do anything with Perforce's ability to track branches or the movement of changesets from branch to branch. -- EricHopper [[DateTime(2005-09-27T06:31:03Z)]]

[http://hg.omnifarious.org/~hopper/p4_to_hg p4_to_hg]

=== Fast (incremental) cvs->hg conversion ===

If you have the cvsroot locally available (i.e. you can more the rcs,v files), you can use
["corecode"]'s fast repo syncer [http://ww2.fs.ei.tum.de/~corecode/hg/cvs20hg cvs20hg].
It's still a little bit rough on the user interface side, but it is being used to sync the
[http://chlamydia.fs.ei.tum.de/hg/dragonfly-src DragonFly repo]. For cvs20hg you'll need the [http://ww2.fs.ei.tum.de/~corecode/hg/rcsparse rcsparse] module as well.

To get it going, do something like this:{{{
cd rcsparse
./setup.py install
cd ../cvs20hg
./setup.py install
hg init /path/to/hgdest
cvs20hg /path/to/cvsroot modulename /path/to/hgdest
}}}

cvs20hg operates incremental, which means that you can run it later again to incoporate new changes from CVS.

-- ["corecode"]

=== Other options ===

Also take a look at {{{contrib/convert-repo}}}. This is an extensible
framework for converting between repository types that is currently used for git to Mercurial conversion.



/hg.py there seems to not use hg addremove/ -- DanConnolly
/it seems to now as of 2005.8.17/ -- MichaelKJohnson
#redirect RepositoryConversion

ConvertingRepositories (last edited 2009-05-19 19:31:05 by localhost)