cvs2git

Index


Introduction

cvs2svn is a tool that was originally developed to migrate CVS repositories to Subversion. The current development version of cvs2svn can also output the converted repository directly to git, a distributed version control system most famous for being used for Linux kernel development. When talking about converting from CVS to git, I will refer to the program as cvs2git, even though the project and the main executable are still called "cvs2svn".

Please note that conversion to git was added in release 2.1 of cvs2svn. Please make sure you are using cvs2svn release 2.1 or newer.

Development status

Most of the work of converting a repository from CVS to a more modern version control system is inferring the most likely history given the incomplete information that CVS records. cvs2svn has a long history of making sense of even the most convoluted CVS repositories, and cvs2git uses this same machinery. Therefore, cvs2git inherits the robustness and many of the features of cvs2svn. cvs2svn can convert just about every CVS repository we have ever seen, and includes a plethora of options for customizing your conversion. See the cvs2svn documentation for a summary of cvs2svn's features.

However, the git output of cvs2git is still rather new and rough around the edges. The main cvs2svn developer is not a git user, so help would be much appreciated! Some of these missing features would be pretty easy to program, and I'd be happy to help you get started.

But thanks to the excellent git-fast-import tool, the code needed to output to git is relatively straightforward, and it is believed that cvs2git can (cautiously) be used for production conversions.

cvs2git still has the following limitations:

Documentation

There is not a lot of documentation specific to cvs2git, but much of the cvs2svn documentation applies fairly straightforwardly to cvs2git. See the following sources:

Usage

This section outlines the steps needed to convert a CVS repository to git using cvs2git.

  1. Be sure that you have the cvs2svn requirements, including either RCS or CVS (used to read revision contents from the CVS repository).
  2. Obtain a copy of cvs2svn version 2.1 or newer.
    • To install cvs2svn from a tarball, simply unpack the tarball into a directory on your conversion computer (cvs2svn can be run directly from this directory).
    • To Check out the current trunk version of cvs2svn, make sure that you have Subversion installed and then run:

      svn co http://guest@cvs2svn.tigris.org/svn/cvs2svn/trunk cvs2svn-trunk
      # The password is empty; i.e., just press return.
      cd cvs2svn-trunk
      make check # ...optional
      

      Please note that the test suite includes tests that are marked "XFAIL" (expected failure); these are known and are not considered serious problems. In fact, the test for git output is marked XFAIL because the cvs2svn test suite doesn't know how to verify the contents of the git repository.

  3. Configure cvs2svn for your conversion. This has to be done via the options-file method. See test-data/main-cvsrepos/cvs2svn-git.options and cvs2svn-example.options in the cvs2svn source tree as examples; both files contain lots of documentation.
  4. Run cvs2svn. This creates two output files in git-fast-import format. The names of these files are specified by your options file. In the example, these files are named cvs2svn-tmp/git-blob.dat and cvs2svn-tmp/git-dump.dat.
  5. Initialize a git repository, and load the dump files using git-fast-import:

    git-init
    cat cvs2svn-tmp/git-blob.dat | git-fast-import --export-marks=cvs2svn-tmp/git-marks.dat
    cat cvs2svn-tmp/git-dump.dat | git-fast-import --import-marks=cvs2svn-tmp/git-marks.dat
    

    This can, of course, be shortened to:

    git-init
    cat cvs2svn-tmp/git-blob.dat cvs2svn-tmp/git-dump.dat | git-fast-import
    

Feedback would be much appreciated, as I am a git newbie. Please send comments, bug reports, and patches to the cvs2svn mailing lists.