cvs2git

Index

cvs2svn/cvs2git is a tool that can be used to migrate CVS
repositories to newer version control tools, including git. git is a distributed version
control system most famous for being used for Linux kernel
development. The program used to convert to git, called cvs2git, is
distributed as part of the cvs2svn project.

If you are reading this documentation on the cvs2svn website, then please be
aware that it describes the current trunk version of cvs2svn, which
may be different than the most recent released version. Please refer
to the documentation that was included with your version of cvs2svn.

Conversion to git was added in release 2.1 of cvs2svn and has
improved significantly since then. Please make sure you are using an
up-to-date version of cvs2svn--perhaps even the development trunk
version.

Direct (filesystem) access to a copy of the CVS repository that
you want to convert. cvs2git parses the files in the CVS
repository directly, so it is not enough to have remote CVS
access. See the FAQ for more
information and a possible workaround.

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.

The output of cvs2git is one or more dump files that can be
imported into git using the excellent git fast-import tool.

Although cvs2git is considerably newer than cvs2svn, and much less
well tested, it is believed that cvs2git can be used for production
conversions. If you use cvs2git, please let us know how it worked for
you!

cvs2git still has many limitations compared to
cvs2svn. 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.

The cvs2git documentation is still not as complete as that for
cvs2svn. See below for more references.

Differences between CVS and git branch/tag models: CVS allows a
branch or tag to be created from arbitrary combinations of source
revisions from multiple source branches. It even allows file
revisions that were never contemporaneous to be added to a single
branch/tag. Git, on the other hand, only allows the full source
tree, as it existed at some instant in the history, to be branched
or tagged as a unit. Moreover, the ancestry of a git revision
makes implications
about the contents of that revision. This difference means
that it is fundamentally impossible to represent an arbitrary CVS
history in a git repository 100% faithfully. cvs2git uses the
following workarounds:

cvs2git tries to create a branch from a single source, but
if it can't figure out how to, it creates the branch using a
"merge" from multiple source branches. In pathological
situations, the number of merge sources for a branch can be
arbitrarily large. The resulting history implies that
whenever any file was added to a branch, the entire
source branch was merged into the destination branch, which is
clearly incorrect. (The alternative, to omit the merge, would
discard the information that some content was moved
from one branch to the other.)

If cvs2git cannot determine that a CVS tag can be created
from a single revision, then it creates a tag
fixup branch named TAG.FIXUP, then tags this
branch. (This is a necessary workaround for the fact that git
only allows existing revisions to be tagged.) The
TAG.FIXUP branch is created as a merge between all of
the branches that contain file revisions included in the tag,
which involves the same tradeoff described above for branches.
The TAG.FIXUP branch is cleared at the end of the
conversion, but (due to a technical limitation of the git
fast-import file format) not deleted. There are some
situations when a tag could be created from a single
revision, but cvs2git does not realize it and creates a
superfluous tag fixup branch. It is possible to delete
superfluous tag fixup branches after the conversion by running
the contrib/git-move-refs.py script within the
resulting git repository.

There are no checks that CVS branch and tag names are legal git
names. There are probably other git constraints that should also
be checked.

The data that should be fed to git fast-import are written to
two files, which have to be loaded into git fast-import manually.
These files might grow to very large size. It would be nice to
add an option to invoke git fast-import automatically and pipe the
output directly into git fast-import; this should also speed up
the conversion.

Only single projects can be converted at a time. Given the way
git is typically used, this is probably what you want anyway.

The cvs2svn test suite does not include meaningful tests of git
output.

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

Be sure that you have the requirements,
including either RCS or CVS (used to read revision contents from
the CVS repository).

Obtain a copy of cvs2svn/cvs2git version 2.1 or newer. It is
recommended that you use the most recent version available, or
even the development version.

To install cvs2svn from a tarball,
simply unpack the tarball into a directory on your conversion
computer; cvs2git 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 --username=guest --password="" http://cvs2svn.tigris.org/svn/cvs2svn/trunk cvs2svn-trunk
cd cvs2svn-trunk
make man # If you want to create manpages for the main programs
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.

Configure cvs2git and run the conversion. This can be done via
command-line options or via an options file:

The command-line options for running cvs2git are documented
in the cvs2git man page and in the output of cvs2git
--help. For example:

The more flexible options-file method
requires you to create an options file, then start cvs2git
with

cvs2git --options=OPTIONS-FILE

Use cvs2git-example.options in the cvs2svn source
tree as your starting point; the file contains lots of
documentation.

This creates two output files
in git
fast-import format. The names of these files are specified
by your options file or command-line arguments. In the example,
these files are named cvs2git-tmp/git-blob.dat and
cvs2git-tmp/git-dump.dat.

Initialize a git repository:

git init --bare /path/to/myproject.git
cd /path/to/myproject.git

Load the dump files into the new git repository using git
fast-import:

(Recommended) To get rid of unnecessary tag fixup branches, run
the contrib/git-move-refs.py script from within the git
repository.

(Recommended) Re-compact the repository and discard any
garbage:

git gc --prune=now

The result of the above procedure is a bare git
repository (one that does not have a checked-out version of the
source tree). This is the type of repository that you would put
on your server. To work on your project, make a non-bare clone
(one that includes a checked-out source tree):