Aug 24, 2011

cvs2hg converted repository with branches and hg convert with filemap destroys data

I had to convert a CVS repository to Mercurial. The CVS repository had a lot
of branches. The conversion was done, as described in my former post about converting a CVS to HG.

After the conversion, there was a root directory in the HG-Repo, which should
be removed.

hg convert --filemap map.txt <source> <target>

would do the magic.

The content of the filemap was:

rename <rootDir> . 

But the resulting HG repository was missing some directories and files.
So this was a not usable for me.
I found the following issue discussing the problem.

The other way to convert was to convert from CVS to SubVersion and
use hg to convert from SubVersion to Mercurial

ATTENTION: for this you need subversion bindings for Python 

cvs2svn --config=svn.cfg

The changes in the svn.cfg from the example were
ctx.output_option = NewRepositoryOutputOption(
to set the SVN Repo

change all the decorders to latin1

and set
the path to the CVS Repository.

After converting to SubVersion, I deployed the Repo to the Apache/WebDav
installation and started the conversion to HG by
hg convert -A authormap http://<SubVersionServer/Repo> <MercurialRepo>

and after this a run with
hg convert --filemap map.txt <MercurialRepo> <strippedRepo> 

and the files were in the new repo with the removed root directory.