ConvertingFromCvs

Converting From CVS

The remainder of this page documents a CVS conversion tool called cvs2darcs. There is a second CVS conversion tool called tailor.py, which some people prefer because it does not depend on cvsps, and is reportedly more reliable when you want to keep a darcs tree in sync with a CVS tree (instead of a one-time conversion). --MarkStosberg

There is a script called cvs2darcs that can import a CVS repository as a Darcs repository and keep it in sync once it is imported, available from:

'''http://ab-initio.mit.edu/cvs2darcs/'''

Or for developers who want to hack on cvs2darcs:

darcs get http://ab-initio.mit.edu/cvs2darcs/cvs2darcs
autoreconf --verbose --install --symlink --force

Configure and install it with:

./configure
make install

(You can omit the second step if you don't have root access and/or just want to run cvs2darcs from the source directory. You can also change the installation directory with the usual --prefix option to ./configure.)

If you have access to the CVS repository itself (and cannot just check out from it), then it will greatly speed things up if you copy the repository to a local disk. You do not need to do anything special to access a local CVS repository; its CVSROOT is just the absolute path of the repository directory. (There is no need to put a :pserver: or :ext: access method in front of the root.) Suppose that the CVS repository is located in "/the/cvsrepo", and that the project you want is called "myproject". Then, you just do:

cvs2darcs -d /the/cvsrepo myproject

This will create a directory "myproject" and convert it to a Darcs repository. Other options for cvs2darcs can be found in its man page, online at: http://ab-initio.mit.edu/cvs2darcs/cvs2darcs-man.html

The script is fairly verbose. You should first see a warning about a file "Tag" not existing. Then it should go on to check out from the CVS repository one version after the other, starting with the oldest. You should also see darcs ask some questions such as "author?" and "name?", but the answers to these will stay hidden. The whole process will take some time. As mentioned above, having the CVS repository available locally helps a lot. There should be some support for checking out CVS branches (see the -b option in the man page).

In 2009, there was a discussion on the mailing list about how to make cvs2darcs work. We talked about "cvsps not found in path" and "invalid argument" errors.


A couple concepts that confuse many CVS users at first:

A branch in darcs is a repository (repo). A repo can contain many tags, but only one branch.

You cannot "roll back" the working directory to an earlier version without actually rolling the whole repo back to that version. Well, you sort of can, but it involves using darcs commands that could be considered risky. Instead, if you want to have a working directory for an earlier version, just create a new repo that only contains patches up to that version. Leave your original repo alone.

As a result, you are likely to need to create new repos fairly often. Since darcs does not manage multiple repos, it is up to you to use good naming and structure to keep everything sane. One recommended approach is to put all the related repos in a single top-level project directory:

MyProject/
  main/
  Branch-1.0/
  PlayAroundWithUtf8/

Using this model, there would be nothing in the MyProject directory except some darcs repos.

Tracking ongoing changes in a CVS repository

Sometimes, rather than doing a one-time conversion to darcs and then sticking with darcs exclusively, you may wish to continue to use CVS but mirror the CVS changes the darcs repository. This is possible with cvs2darcs. First, when you run cvs2darcs for the first time, you should pass the --preserve-cvs flag to preserve the CVS information in the checkout directory. Alternatively, just run cvs2darcs in an existing checkout directory:

cd /path/to/checkout/directory
cvs2darcs .
cvs update -A

(The last command resets any sticky tags set during the cvs2darcs conversion.) Then, work with the CVS repository as usual, committing patches or updating to get new ones. At any point in time, you can then run

cvs2darcs .
cvs update -A

to bring the darcs repository into sync with any CVS patches checked in since the last cvs2darcs invocation.