cvs2svn cookbook

I have been converting some of my old cvs repositories to subversion with cvs2svn. It is a pretty handy little tool (even if it is fairly limited.) Here are a couple hints I had to figure out via trail and error.

3 thoughts on “cvs2svn cookbook”

  1. I’m currently the main maintainer/developer of cvs2svn, so I read your post with interest.

    Please be fair and let us know why you think cvs2svn “is fairly limited”. Maybe there is already a solution to your problem (or maybe you will stimulate a solution in cvs2svn version N+1 🙂 ).

    Regarding the second tip on your “tip sheet”: The method that you discribe will work. But if you are able to convert projectA, projectB, and projectC at the same time, you should think about using cvs2svn’s “multiproject conversion” feature. This approach has the advantage that commits from different projects are properly interleaved in chronological order.

  2. You are right, I should have been more specific about the limitations I found with cvs2svn. My primary problem is that I have a CVS repository with the following structure:

    cvsroot / ProjectA
    / ProjectB
    / ProjectC
    / ProjectD
    / ProjectE
    / ProjectF

    I want to convert ProjectA, ProjectB, and ProjectC over to SVN, but I do not want the other projects moved over. What is more I want the repository structure as follows:

    svnrepo / Trunk / ProjectA
    / ProjectB
    / ProjectC
    svnrepo / Branches / ProjectA
    / ProjectB
    / ProjectC
    svnrepo / Tags / ProjectA
    / ProjectB
    / ProjectC

    I tried a number of different ways to do that but failed to find anyway to accomplish it. I don’t want to import all the projects and then delete the ones I don’t need because I may want to import some of them later on. If there is a solution that I am not aware of; then I owe you an apology..

  3. It’s easy, as long as you are using cvs2svn version 1.5 or later. Use the “multiproject conversion” feature as described in the docs. For your scenario, you can use the “–options” option to start cvs2svn, and include the following stanza in your options file:

    > for p in [‘projectA’, ‘projectB’, ‘projectC’]:
    > ctx.add_project(
    > Project(
    > ‘cvsroot/%s’ % p,
    > ‘Trunk/%s’ % p,
    > ‘Branches/%s’ % p,
    > ‘Tags/%s’ % p,
    > )
    > )

    (Of course you can write out the three add_project() calls separately if you want more customization or if you are uncomfortable with a Python loop.)

Comments are closed.