Working smarter not harder

Using cvs2svn on Windows (Converting a CVS repository to SVN)

After running into multiple problems while trying to setup cvs2svn conversion scripts to test on my local windows machine I decided to create a guide to help anyone who is going down this path.

Step 1. Download/Extract Scripts
First you will need to get the actual scripts that do the conversion process.

Download the cvs2svn scripts: http://cvs2svn.tigris.org/

Extract the cvs2svn directory to wherever you want it. e.g C:\cvs2svn-2.3.0

Step 2. Download/Install Python

The cvs2svn scripts are written in Python so you will need to install Python to run them.

Download Python (check which version is required by cvs2svn, at time of writing v3 wasn't supported):
http://www.python.org/download/windows/

Install Python.

Add the Python root directory to your PATH (e.g C:\Python27). Then open command prompt and make sure it is working by typing 'python'

Step 3. Download/Extract Unix Utils

The cvs2svn scripts require the Unix sort tool to run, the easiest way to get around this on Windows, is to use the unxutils tools.

Download GNU sort for windows: http://sourceforge.net/projects/unxutils/

Extract the utils e.g to C:\unix-utils\

Step 4. Download/Install Subversion

There are a number of Subversion packages for Windows, I used Slik SVN.

Download Subversion: http://subversion.apache.org/packages.html

Install Subversion.

Note for Slik SVN: Make sure you select custom setup and select SvnServe (this installs the svn server).

When install has finished open command prompt and make sure svn is working by typing 'svn'

Step 5. Do the CVS to SVN conversion

Create a new directory for your svn repo e.g C:\svn-repo

To create the SVN repository go to the command line and type ‘svnadmin create c:\svn-repo\repo’

Finally to run the conversion scripts go to the wbin dirctory of the GNU utils (e.g C:\unix-utils\usr\local\wbin) and type 'python C:\cvs2svn-2.3.0\cvs2svn -s c:\svn-repo\repo --existing-svnrepos c:\data\cvs_repo\repo\TestApp'

Note: If you get the error ‘ERROR: Command failed with return code 1: "sort -T cvs2svn-tmp cvs2svn-tmp\revs-summary.txt"’ this is because you did not run the script inside the GNU utils wbin directory.

Next you will need to start-up svnserve so you can connect to your new repository. You can setup svnserve to run as a windows service but for the sack of simplicity for this tutorial we will just run it as a deamon. To run svn server as a daemon type 'svnserve -d'into the command prompt.

Step 6. Accessing your new SVN repository

Install the Subclipse plugin for your version of Eclipse http://subclipse.tigris.org/

Connect to the repo e.g. svn://localhost/svn-repo/repo

Note: On Windows Vista/7 if you get the error ‘No connection could be made because the target machine actively refused it’ when trying to connect to your Subversion repository you need to start svnserve with the parameter --listen-host 0.0.0.0 this has something to do with IPv6.

How can I convert project foo so that trunk/tags/branches are inside of foo?

This is useful when you want to create an SVN repository that has multiple projects inside it.

If foo is the project that you want to convert, then run cvs2svn like this:

Python C:\cvs2svn-2.3.0\cvs2svn -s c:\svn-repo\repo --existing-svnrepos --trunk=foo/trunk --branches=foo/branches --tags=foo/tags c:\data\cvs_repo\repo\foo'

13 Comments

  1. V R P's Gravatar V R P
    February 14, 2011    

    By far THE MOST helpful guide to using CVS2SVN I've found. Unless I was being a complete doink, the Tigris.org documentation looks to be far from complete. I can't thank you enough.

    • admin's Gravatar admin
      February 19, 2011    

      I'm glad you found my guide useful, its always good to hear positive feedback.

  2. mellda's Gravatar mellda
    May 23, 2011    

    Great step-by-step giude! I have looked exactly something like this. Thanks very much.

  3. mellda's Gravatar mellda
    May 23, 2011    

    Only note: in my case I have to use this command for conversion:
    ‘python C:\cvs2svn-2.3.0\cvs2svn -s c:\svn-repo\repo --existing-svnrepos c:\data\cvs_repo\repo\TestApp’. That is: --existing-svnrepos instead of -existing-svnrepos. The same in command ‘svnserve -d --listen-host 0.0.0.0’.

    • mellda's Gravatar mellda
      May 23, 2011    

      There are two hyphons instead of one in front of the word EXISTING (same for LISTEN).

      • admin's Gravatar admin
        May 24, 2011    

        Thanks for the heads up, turns out wordpress automatically replaces the double dashes with a single one. I have worked some magic which has fixed the article.
        Thanks again :)

  4. Mike's Gravatar Mike
    July 13, 2011    

    I really need your help...

    I'm intending to do the step where you migrate the repositories from CVS to SVN but when I execute the command
    'python cvs2svn ...'

    The compilation from python results in this..
    File "cvs2svn", line 71
    except FatalException, e:

    Is there a way to solve this?

    Thanks a lot for your help!
    This guide it's pure gold.

    • timothyja's Gravatar timothyja
      July 18, 2011    

      Are you sure you are using the right version of Python?

      cvs2svn does not work with Python 3.x

  5. suresh's Gravatar suresh
    November 11, 2011    

    Hi,

    Thanks a lot yar!!!!
    It helped me a lot in the migaration of cvs to svn with history.

    Regards,
    Suresh.

  6. Ahmed Ali's Gravatar Ahmed Ali
    December 14, 2011    

    This is a great tutorial which made my work too easy...
    Thanks a lot

  7. cvs@svn converter's Gravatar cvs@svn converter
    December 15, 2011    

    Hi..

    Thanks a loot for this wonderful post.
    Great work ...
    takes beginners like jme a looong way

  8. Anand's Gravatar Anand
    April 3, 2012    

    I doing it 1st time and successfully completed in same day.
    Thanks a lot... Great Great work

  9. Dee's Gravatar Dee
    June 5, 2012    

    Thanks for the great guide, it has been really helpful.

    One thing to note, if you plan on using something like CollabNet's SubversionEdge, it is best to do the conversion first with a basic version of svn, such as SilkSVN, as recommend in the guide. SubversionEdge (3.0.1) installs a non-standard version of Python 2.5 which can cause problems with the cvs2svn process.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Support Linux OpenGL Development

You can use Flattr to help support my Mesa development work. I'm currently hoping to buy a laptop with Nvidia graphics so I have a good reference driver to test against.
Support my development efforts on the Linux OpenGL Drivers (Mesa)
Choose donation amount: