Cvs Repository Splitting

Suppose you have two projects, named "one" and "two", in a single CVS repository named "common". Your directory structure looks something like this:

    /home
                              |- one
                              `- two

In other words, the CVS repository is rooted at /home/cvs/common. All the source files are in /home/cvs/common/one and /home/cvs/common/two and the administrative files are in /home/cvs/common/CVSROOT. Our objective is to split this one repository into two, as follows:

    /home
                   |       `- one
                   |
                   `- two
                           `- two

In the new setup, the first CVS repository is at /home/cvs/one and the second CVS repository is at /home/cvs/two. Each has its own subdirectory for content and for administrative files.

The first step is to create the new directories and copy in the appropriate files.

    mkdir /home/cvs/one
    mv /home/cvs/common/one /home/cvs/one
    mkdir /home/cvs/one/CVSROOT
    cp /home/cvs/common/CVSROOT/* /home/cvs/one/CVSROOT
    mkdir /home/cvs/two
    mv /home/cvs/common/two /home/cvs/two
    mv /home/cvs/common/CVSROOT /home/cvs/two
    rmdir /home/cvs/common

Notice that the content files for each project were moved into their appropriate CVS repository but that the administrative files were copied into both of the new repositories. The next step is to modify the CVSROOT/history files in each of the new repositories so that they only contain information about the files in their respective repositories.

    cd /home/cvs/one/CVSROOT
    mv history history.orig
    grep 'one/' history.orig >history
    cd /home/cvs/two/CVSROOT
    mv history history.orig
    grep 'two/' history.orig >history

We're done. Now each project is in its own CVS repository. Now you can create a separate CVSTrac database for each project.