Package: cvs2hg
Convert CVS repositories into Mercurial. Contrary tohg convertproperly handle tags and branches.cvs2hg purposecvs2hg converts CVS repositories into Mercurial ones and
does much better job than hg convert preserving appropriate
tags and branchpoints contents.Most important case is that of manually tweaked tags.
Example scenario:cvs commit file1 file2 file3 file4
cvs tag blah_1-0-0      # covers 1.1 versions of all files
cvs commit file2 file3 file1    # makes 1.2
cvs commit file1        # makes 1.3
cvs tag -r blah_1-0-0 blah_1-0-1
cvs tag -F blah_1-0-1 file1(tagblah_1-0-0is created as copy ofblah_1-0-0, but manually
moved to newer version offile1– fairly frequent way of backporting
bugfixes in CVS world, handy as it avoids CVS branch creation).Even simpler scenario: some tag (on purpose or accidentally) omits some files.hg convertis lost in such cases. In aggregated history there is
no point of time at whichfile2,file3, andfile4were at1.1, butfile1was at1.3. Sohg convertbindsblah_1-0-1at some random place (usually nearby initial revision).cvs2hgresolves that by creatingfixup commit- artificial
change which brings repository content in sync with tag being
converted (removes files which were omitted by cvs tag, applies
partial changes to selected files only…). The net result is that:hg up -r blah_1-0-1gives exactly the same files, with exactly the same contents, as:cvs up -r blah_1-0-1The cost is that history contains those commits - in most cases
tiny triangular branches like:|
o
|\
| |
| |
| o [blah_1-0-1]   <--- fixup commit
|/
|
|
o
|The same problem and solution applies to branches which started
from such a tag (there fixup commit may init longer branch).See also longer discussion in README.cvs2hg in the source code.cvs2hg installationInstall from pypi:pip install cvs2hgor install from source:hg clone https://foss.heptapod.net/mercurial/mercurial-cvs2hg

cd mercurial-cvs2hg
sudo python setup.py install(or install in virtualenv, or install locally usingpip).cvs2hg usageUsual way to run the conversion:Grab,vfiles of module being converted somehow (you need read
access to the server CVS repository). To run the conversion,
you need the following directory tree (say you convertlibs/acmewhich
has some files and also doc subdir):someWorkDir
  |
  +--- CVSROOT    (can be empty directory, just marks where root is)
  |
  |
  +--- libs
         |
         |
         +--- acme
                |
                +-- something.h,v
                |
                +-- something.c,v
                |
                +-- doc
                      |
                      +-- README.txt,v
                      |
                      +-- Attic
                            |
                            +-- BUGS.txt,vRun the command:cd someWorkDir

cvs2hg --hgrepos=$HOME/repos/libs/acme \
      --encoding utf8 --encoding iso-8859-2 \
      libs/acme(adapt encoding to your needs, that’s list of encodings which could be used in commit
messages)Examine resulting Mercurial repository (with the command above it would be$HOME/repos/libs/acme). At times some history edition may make
sense (like dropping unnecessary branches or tags, or even
performing Mercurial to Mercurial conversion to modify usernames).Source code and it’s historycvs2hgwas created by Greg Ward, as fork ofcvs2svn(which,
contrary to it’s name, handled also conversion to git and Bazaar),
extended to support Mercurial. Later on it was patched by Marcin Kasperski
to support newer Mercurial versions.As the work was never merged back upstream, and presence ofcvs2svnscript (and library) happened to cause confusion, the
repository was finally cleaned up from most non-Mercurial related code
and exists now as purely CVS → HG conversion tool.Current repository:https://foss.heptapod.net/mercurial/mercurial-cvs2hgHistorical repositories:https://bitbucket.org/Mekk/mercurial-cvs2hg(Marcin Kasperski patches until 2020)http://hg.gerg.ca/cvs2svn(Greg Ward’s repository)http://cvs2svn.tigris.org/cvs2svn.html(original cvs2svn).