bug in convert

Greg Ward greg-hg at gerg.ca
Tue Jul 21 17:04:43 CDT 2009


On Tue, Jul 21, 2009 at 2:49 AM, Christoph Egger<Christoph_Egger at gmx.de> wrote:
> To allow a smooth migration, mercurial (and all other scm's) must permit
>
> - to convert cvs to hg

Be warned that git and Mercurial both include tools for converting
from CVS that are simple, easy-to-use, fast, and wrong.  'hg convert'
(and, I believe, git-cvs-import) will give you a Mercurial (or git)
repo with all your code in the right order, but with tags and branch
points not necessarily converted correctly.  It's a good way to dip
your feet in the water and see if you like the feel of Mercurial on
your code, but not suitable for a production-quality conversion.

AFAIK, there is only one tool that can correctly handle CVS
repositories with all their quirks and strangeness: cvs2svn.  It has
recently sprouted a new growth called cvs2git, and I'm currently
working on giving it a usable cvs2hg.

> - to import new cvs history into hg (after conversion)

In general, this is impossible.  (What if you create a tag or branch
that refers to revisions already converted?)  'hg convert' gives it a
brave try, but I wouldn't trust it.

> I retried and this is the result:
>
> 802600 sys/arch/hpcmips/conf/GENERIC
> 802700 sys/arch/hpcmips/conf/LCARD
> run hg sink post-conversion action
> ** unknown exception encountered, details follow
> ** report bug details to http://mercurial.selenic.com/bts/
> ** or mercurial at selenic.com
> ** Mercurial Distributed SCM (version 1.3)
> ** Extensions loaded: convert, rebase
> Traceback (most recent call last):
>  File "/sw/bin/hg", line 27, in <module>
>    mercurial.dispatch.run()
> AssertionError: expected revision number (got '')
> cvs [rlog aborted]: received broken pipe signal

OK... that's slightly more useful.  I must remember to submit a proper
patch for that.

>> Finally, can you show us the output of "cvs rlog" on a representative
>> file?  (Ideally the one that caused the crash, but I'm not sure if
>> that info is available to you.  Running with --debug might help.)
>
> $ cvs rlog src/sys/arch/hpcmips/conf/LCARD
>
> RCS file: /cvsroot/src/sys/arch/hpcmips/conf/LCARD,v
> head: 1.11
> branch:
[...lots of 'cvs rlog' output skipped...]
> ----------------------------
> revision 1.1
> date: 2003/05/01 07:01:58;  author: igy;  state: Exp;
> branches:  1.1.2;
> Support for Laser5's L-Card+ Embedded CPU Board
> ===============================================
[...]
> L-Card+ Embedded CPU Board
> --------------------------

And here it is: a line with 28 dashes.  Sheesh, I thought *everyone*
knew not to put lines with 28 dashes in their CVS commit messages.
That's your problem.

Since hg's CVS conversion is based on parsing "cvs rlog" output, I
don't see a quick and easy fix in the code.

One possible temporary workaround is to exclude that file from the
conversion.  You should be able to do that with a filemap (see hg help
convert).

Another workaround is to edit the CVS log message for that revision.
Be very very careful if you do that; you can easily destroy valuable
history.  Better to work on a copy of the repo if you can arrange
that.  (e.g. rsync it over, or use something like cvssuck if you don't
have rsync access to the server).

Hopefully I'll have a working cvs2hg in a couple of days.  Keep an eye
on this list: I'll be looking for testers soon!

Greg



More information about the Mercurial mailing list