A Primer on CVS

Disclaimer: This is the way I use it at my job. It's pretty much "plain vanilla" use of CVS. Your mileage may vary :-).

This assumes you have built CVS version 1.3 (or greater), have initialized a repository, and the environment variable CVSROOT will get you to the repository.

Setup a module "foo":

    cd directory_containing_foo_files
    # copy files/subdirectories into the foo directory.
    cvs import foo local baseline
    # note: "foo" = module name, "local" = vendor, "baseline" = revision
Checkout the module, make changes, commit (checkin) changes:
    cd somewhere
    cvs co foo          # creates dir "foo"
    cd foo
    # edit, test; edit, test; edit, test; ...
    cvs commit
Add a new file to the module, commit the addition:
    # create (using your favorite editor) newfile.c.  Then:
    cvs add newfile.c
    # edit, test; edit, test; edit, test; ...
    cvs commit
Delete a file from the module, commit the change
    rm obsolete.c
    cvs remove obsolete.c
    # edit, test; edit, test; edit, test; ...
    cvs commit
    # note:  the version history of obsolete.c is stored in the "ATTIC"
    # of the repository, so you can retrieve old versions of the module;
    # this means you can NEVER add a file named "obsolete.c" to the
    # module.  A "generalized renaming capability" will someday be added
    # to CVS, but it's a difficult problem, so don't hold your breath.
Tag the current version of the module (make a checkpoint):
    cvs tag rev_2_1
Checkout an old version of the module, and build it:
    cd somewhere
    cvs co -N -d foo.rev_1_2 -r rev_1_2 foo
    cd foo.rev_1_2
    make
Make a branch tag, to separate mainline and patch development:
    cd somewhere/foo
    cvs tag -b branch_1_2
Setup a separate development area for branch development:
    cd somewhere
    cvs co -N -d foo.branch_1_2 -r branch_1_2 foo
    cd foo.branch_1_2
    # edit, test; edit, test; edit, test; ...
    cvs commit
Create a directory to merge the branch changes into the trunk
    # (I think this is how you do it, I haven't tried it yet!)
    cd somewhere
    cvs co -N -d foo.merge -j branch_1_2 foo
    cd foo.merge
    # edit, test; edit, test; edit, test; ...
    cvs commit
Setup another module, "bar", as done with "foo"

Checkout the modules file and define the module "foobar" consisting of the sub-modules foo and bar:

    cd somewhere
    cvs co modules
    cd modules

    # edit modules file, inserting the following line (not indented):
    foobar &foo &bar

    cvs commit
Checkout the new module foobar:
    cd somewhere
    cvs co foobar
    cd foobar
    ls -l
    # there will be a "foo" and a "bar" subdirectory
Checkout the modules file and define the module "subset" consisting of a subset of the module foo, consisting of the files "fee", "fie", and the directories "fo", and "fum"
    cd somewhere
    cvs co modules
    cd modules

    # edit modules file, inserting the following line (not indented):
    subset foo fee fie fo fum

    cvs commit
Checkout the new module subset:
    cd somewhere
    cvs co subset
    cd subset
    ls -l
Throwaway everything, you can always get it back (assuming you have committed your changes):
    cd somewhere
    rm -rf *
That's about it for now. Good luck.


by Steve Harris - Eaton Corp. - Beverly, MA - vsh%etnibsd@uunet.uu.net