Migrating CVS to SVN with cvs2svn - Basics for a Windows user

This tutorial shows the first steps how to test the cvs2svn tool in a Windows environment requiring minimal knowledge about CVS and SVN. The steps described have the purpose introduce you in the simplest ways how to create a CVS and a SVN repository and migrate CVS repositories to SVN repositories.

To run the cvs2svn tool and make use of some Linux tools, I opted to use a Linux-like environment for Windows called cygwin.

You can make all the steps simply using cygwin. However, as a Windows user, I think using the clients TortoiseCVS and TortoiseSVN could be more convenient, so is up to you to choose the most convenient way for you. 

The commands mentioned in this tutorials that begin with $ are for cygwin, the ones that begin with > are for MS-DOS.

Tools required

  • Install cygwin (with python, cvs, svn, gnutls, optionally rxvt, which I recommend). If you want to use rxvt on top of cygwin, create an icon with following target and start it: C:\cygwin\bin\rxvt.exe -bg black -fg yellow -cr blue -bd pink -fn “Lucida Console-16″ -ls -st -sr -sl 2000 -tn xterm -e /usr/bin/bash –login -i
  • Install TortoiseCVS and TortoiseSVN.
  • Install the SVN Server for windows (or optionally use the svn server in cygwin
  • Install cvs2svn using cygwin: download the cvs2svn file and unpack (e.g. in C:/Program Files).
    $ cd /c/Program\ Files/cvs2svn-2.1.0/
    $ make install

Create a CVS repository

Using MS-DOS:

> set CVSROOT=C:/CVSServer
> cvs init

Using cygwin:

$ export CVSROOT=C:/CVSServer
$ cvs init

Create and checkout a new CVS Module

Using cygwin:

$ cd <path to a directory that contains initial data to be uploaded to the new module>
$ cvs import -m “First new module” MyFirstModule sts start
 
$ cd <path to the directory where the new module shall be checked out>
$ cvs co MyFirstModule

Using TortoiseCVS:

  • Create a new folder
  • In Windows Explorer right click this folder and choose the option “CVS -> Make New Module…”
  • Choose the protocol “Locally mounted folder (:local:)”, enter the repository path “C:/CVSServer” and enter the name of the new module. The CVSROOT field will be automatically build as “:local:C:/CVSServer”. After clicking OK, this folder will automatically be checked out.
  • Copy some initial data into the new folder, mark the content, right click and choose the option “CVS Add…” and then “CVS Commit….”

Migrate the CVS repository into SVN

Now we can run the cvs2svn tool to migrate the previously created CVS repository to a new SVN repository. Try the following command in cygwin:

$ /c/Program\ Files/cvs2svn-2.1.0/cvs2svn –svnrepos /c/SVNServer/ /c/CVSServer/MyFirstModule

After performing the command above, a new directory should have been created (C:\SVNServer\). Now the new SVN repository needs to be configured.

Configure the new SVN repository

Open the file C:\SVNServer\conf\svnserve.conf and uncomment the following settings:

[general]
anon-access = read
auth-access = write
password-db = passwd

Open the file C:\SVNServer\conf\passwd and uncomment the following settings:

[users]
harry = harryssecret
sally = sallyssecret

Start the SVN server

You have a few different ways how to make the new SVN repository available for check outs.

One way is making the repository available as a SVN server - so, the repository will be available within your local network:

$ svnserve –daemon –root /c/SVNServer

Alternatively you can start the SVN server as a windows service - open the MS-DOS console and enter the following command:

> sc create svnserve binpath= “\”C:\Program Files\Subversion\bin\svnserve.exe\” –service -r C:\SVNServer” displayname= “Subversion Server” depend= Tcpip start= auto

Checkout the migrated SVN repository

If you have started the SVN server, you can use the address svn://localhost/trunk for the checkout. If you would rather like just to use the file system, you can use the address file:///C:/SVNServer/trunk.

Using cygwin or MS-DOS:

cd <path to the directory where the repository shall be checked out>

svn co <svn address as described above>

After performing the command above, a new directory should have been created with the same name as in the command argument.

Using TortoiseSVN

  • Create a directory that will contain a copy of the files in the SVN repository
  • Right-Click on the new created folder and choose option “SVN Checkout…”
  • Enter the address as described above and press the OK button.

How to create a new SVN repository and import initial data

To create a new SVN repository, you can use the following command:

$ svnadmin create /c/NewSVNServer

Now you can enter the folder that contains initial data that will be uploaded and then perform the import command.

$ cd <directory with initial data>

$ svn import -m “Import initial data” svn://localhost/trunk/