Linux

Converting from CVS to Subversion

When converting to Subversion from CVS, you will want to import your CVS repository with its associated history. Vincent Danen tells you how.

Switching from one version control system to another can be a daunting task; not only do you need to learn the new system, but you need to find a way to retain as much history of your project as you can. Converting from CVS to Subversion gives the same problem, and there are a couple of solutions: The first is to give up the history of your project as stored in CVS, to maintain your CVS repository as read-only for the history, and to start the Subversion repository from scratch; or you can try to import your CVS repository with all associated history into Subversion.

The last is the most desirable and also the most difficult. Fortunately, some tools exist to help with this, including cvs2svn, a program that attempts to import your old CVS projects and their history into a Subversion repository. cvs2svn can be downloaded from http://cvs2svn.tigris.org/.

Tips in your inbox
Delivered each Tuesday, TechRepublic's free Linux NetNote provides tips, articles, and other resources to help you hone your Linux skills.
Automatically sign up today!

The first step is to download cvs2svn and untar the tarball. Next, make a copy of your cvsroot; although cvs2svn does nothing to the CVS repository itself, it's prudent to work from a copy rather than the real thing, just in case.

For instance:

<code>
$ mkdir -p ~/tmp/newcvs/CVSROOT
$ cp -av /cvsroot/* ~/tmp/newcvs/
</code>

If you wish to only import one module, you can do so by copying /cvsroot/project rather than the entire cvsroot directory and all the modules it contains. The next step is to run cvs2svn on the copied cvsroot and make a dumpfile suitable for Subversion to import:

<code>
$ ./cvs2svn --dump-only ~/tmp/newcvs
</code>

This will create the file cvs2svn-dump in the current directory. Now you can import the dump file into an existing Subversion repository:

<code>
$ svn mkdir file:///home/user/Subversion/repos/project -m "Initial
project import"
$ svnadmin --parent-dir project load /home/user/Subversion/repos < cvs2svn-dump
</code>

At this point, your project, with all associated history, has been imported. The above is suitable if you have an existing Subversion repository and want to import a module at a time, or only a few modules. If you want to do a straight dump of your entire cvsroot into a new Subversion database you can use:

<code>
$ ./cvs2svn -s /home/user/Subversion/repos /cvsroot
</code>

This will import the entire cvsroot and its history into the new Subversion repository. Depending on how large the CVS repository is (and how much history it has), this may take some time.

About

Vincent Danen works on the Red Hat Security Response Team and lives in Canada. He has been writing about and developing on Linux for over 10 years and is a veteran Mac user.

0 comments