Who we are

We are the developers of Plastic SCM, a full version control stack (not a Git variant). We work on the strongest branching and merging you can find, and a core that doesn't cringe with huge binaries and repos. We also develop the GUIs, mergetools and everything needed to give you the full version control stack.

If you want to give it a try, download it from here.

We also code SemanticMerge, and the gmaster Git client.

How to migrate CVS repositories to Plastic SCM

Thursday, April 18, 2013 calbzam 2 Comments

In this entry I will try to explain you how to migrate CVS repositories into Plastic SCM with two examples.

Things we need:

    A CVS repository
    Git installed
    Plastic SCM

  • OPTION 1: Using git cvsimport command, and then exporting from git to Plastic.
  • First of all, we have to be sure CVSROOT environment variable points to the CVS repository directory. A good choice is:

    setenv CVSROOT /usr/local/src/cvsroot

    You may need to checkout a repository from your server or a collaborating web like Sourceforge :

    cvs -d :pserver:username@projectname.domain.net:/cvs checkout REPO

    rsync -av rsync://gcgreatcode.cvs.sourceforge.net:/cvsroot/gcgreatcode/* gcode

    Once we have the CVS repository in a local folder, we have to create a new folder in order to store the git repository.

    mkdir gcode-git
    cd gcode-git
    

    Now we are ready to execute the first import command which is “git cvsimport” . A “.git” folder will be generated.

     git cvsimport  -v -d :local:/home/plastic/Downloads/gcode GC

    We need to provide the repository path and repository name. In the example the correct information is “/home/plastic/Downloads/gcode” for the path and “GC” for the repository name.

    Now, if we execute the “git branch” command, we can check that all the branches are correctly exported to git.

    We have now our repository inside git. At this point, we only have to create a git fast-export file, and import the file to Plastic SCM (same as we did with Mercurial migration), indicating the Plastic SCM server and repository name we want to create.

    git fast-export --all -C repo.fe

    cm fast-import myrepo@localhost:8087 repo.fe

  • OPTION 2: Using cvs2git (Tigris project : http://cvs2svn.tigris.org/cvs2git.html), and then exporting from git to Plastic.
  • cvs2svn/cvs2git is a tool that can be used to migrate CVS repositories to newer version control tools, including git. This tool is part of the cvs2svn project. Although cvs2git is considerably newer than cvs2svn, and much less well tested, it is believed that cvs2git can (cautiously) be used for production conversions.

    We can download the lastest version from the http://cvs2svn.tigris.org/cvs2git.html webpage.To install cvs2git from a tarball, simply unpack the tarball into a directory on your conversion computer (cvs2git can be run directly from this directory).

    Before executing the cvs2git tool we have to create a folder to store the results (e.g. cvs2git-tmp) and we also have to create two empty files (“git-blog.dat” and “git-dump.dat”). Those files will be used by the tool to store the result and the migration data. We execute cvs2git command indicating the CVS repository path:

    cvs2git \
     --blobfile=cvs2git-tmp/git-blob.dat \
        --dumpfile=cvs2git-tmp/git-dump.dat \
        --username=cvs2git \
        /path/to/cvs/repo
    

    This command will write in the two output files we created in the previous step. Next step, is to create an empty git repository in a new folder and initialize it:

    mkdir myproject.git
    cd myproject.git
    git init –bare
    

    This way we can load the dump files into the new git repository using the git fast-import command:

    git fast-import --export-marks=../cvs2git-tmp/git-marks.dat < ../cvs2git-tmp/git-blob.dat
    git fast-import --import-marks=../cvs2git-tmp/git-marks.dat < ../cvs2git-tmp/git-dump.dat
    

    On Linux/Unix this can be shortened to:

    cat ../cvs2git-tmp/git-blob.dat ../cvs2git-tmp/git-dump.dat | git fast-import

    Finally, as we saw in Option 1 example, we only have to create a git fast-export file and import it to Plastic:

    git fast-export --all -C repo.fe
    cm fast-import myrepo@localhost:8087 repo.fe
    

    And that's all! Now, it´s your turn to decide which option you prefer to migrate your repositories.

    Carlos Alba
    I joined the Plastic product experts team back in 2013.
    As a Plastic SCM product expert, I try to help teams moving from other version controls on a daily basis, decide strategies, train developers, answer questions, run benchmarks ...
    I love soccer and rock music. You can reach me at @albazamanillo.

    2 comments:

    1. For all the Windows users out there - this ONLY works with the Cygwin GIT release. The msysgit doesn't support the cvsimport command in the Windows port.

      Also, for cranky CVS repos, it may be necessary to use the actual CVS/CVSNT executable if the internal -cvsimport command fails.

      If you know how to use Linux, you are probably better off using the Linux client as indicated in this blog.

      @codicesoftware
      Thanks for putting together these instructions!

      ReplyDelete
    2. @SilverKnight Thanks for your comment for Windows users.
      If possible I would also recommend to perform the migration using Linux

      ReplyDelete