Skip to content

ConvertCvsToSvn

Jonathan Guyer edited this page Sep 26, 2014 · 1 revision

Converting a CVS Project to SVN

 * Obtain [http://cvs2svn.tigris.org/ cvs2svn]
     note::
      `cvs2svn-1.3.0/www/faq.html` covers this, but if you follow its directions exactly, you will get the rather ridiculous
      {{{
       REPOSITORY
          |
          |---> ${PROJECT}
          |         |
          |         |---> trunk
          |         |        |
          |         |        |---> ${PROJECT}
          |         |
          |         |---> branches
          |         |        |
          |         |        |---> BRANCH1
          |         |        |       |
          |         |        |       |---> ${PROJECT}
          |         |        |
          |         |        |---> BRANCH2
          |         |                |
          |         |                |---> ${PROJECT}
          |         |
          |         |---> tags
          |                  |
          |                  |---> TAG1
          |                  |       |
          |                  |       |---> ${PROJECT}
          |                  |
          |                  |---> TAG2
          |                          |
          |                          |---> ${PROJECT}
          |
          |---> SOME_OTHER_PROJECT1
          |
          |---> SOME_OTHER_PROJECT2
      }}}
      instead of the more desirable
      {{{
       REPOSITORY
          |
          |---> ${PROJECT}
          |         |
          |         |---> trunk
          |         |
          |         |---> branches
          |         |        |
          |         |        |---> BRANCH1
          |         |        |
          |         |        |---> BRANCH2
          |         |
          |         |---> tags
          |                  |
          |                  |---> TAG1
          |                  |
          |                  |---> TAG2
          |
          |---> SOME_OTHER_PROJECT1
          |
          |---> SOME_OTHER_PROJECT2
      }}}
 * Make a copy of the portion of the CVS repository governing the project in question
    {{{
    #!sh
    $ PROJECT=MyProjectInCVS
    $ mkdir cvs2svnSandbox
    $ cd cvs2svnSandbox
    $ cp -r /path/to/cvs/repository/${PROJECT} ${PROJECT}
    }}}
 * Convert the CVS project repository copy into an SVN repository dump file
    {{{
    #!sh
    $ mkdir ${PROJECT}/CVSROOT
    $ cvs2svn --dump-only ${PROJECT}
    }}}
    You should now have a file `cvs2svn-dump` in your working directory.
 * If necessary, create an SVN repository::
    {{{
    #!sh
    $ svnadmin create --fs-type fsfs /path/to/svn/repos
    }}}
     note:: 
        An FSFS repository has fewer permissions problems than a Berkeley-DB 
        repository.
 * Make sure that the new repository has appropriate group permissions (this is
    still a bit fuzzy for me)
    {{{
    #!sh
    $ chgrp -R $GROUP /path/to/svn/repos
    $ chmod -R g+w /path/to/svn/repos
    }}}
 * Add a stub for the new project
    {{{
    #!sh
    $ svn mkdir file:///path/to/svn/repos/${PROJECT} -m "added ${PROJECT} directory"
    }}}
  * Import the converted project repository into SVN
    {{{
    #!sh
    $ svnadmin --parent-dir $PROJECT load /path/to/svn/repos < cvs2svn-dump
    }}}
 * You can now test a checkout
    {{{
    #!sh
    $ svn checkout svn+ssh://MACHINE.IP.ADDR/path/to/svn/repos/${PROJECT}/trunk SVNTEST
    }}}
 * At this point, you can get rid of all of the conversion materials
    {{{
    #!sh
    $ cd ..
    $ rm -rf cvs2svnSandbox
    }}}
Clone this wiki locally