CVS

  • Concurrent Versions System
  • GPL
  • Part of Source Configuration Management (SCM)
  • Similar to RCS, PRCS, and Aegis
  • Every developer works in their own directory; CVS merges the work when each developer is done.
  • Stores only the difference between versions of a file
  • CVS does not keep a record of groups of files that were changed together (though the log message for each would be the same)
  • All files are stored in a central repository
  • There is no need to lock files before editing them
  • Repository: The master set of files (as opposed to a local copy of the files); $CVSROOT is the location of the repository
  • Module: A project, a related set of files within a repository; defined in the 'modules' file
  • CVS --help-options
  • CVS --help-commands
  • CVS --help <command>

Commands

Checkout a file

# Check out all files in <cvs-dir> to the current directory (recursively).
cvs [-P] [-d <cvsroot-path>] <checkout|co> <cvs-dir>
  • The -P option prunes empty directories.

Identifying changes

# See how the working copy of a file has changed (since it was checked out)
cvs diff <file>

# Compare specified revision against working copy
cvs diff -r <tag> <files>

# Compare specified revision against another revision
cvs diff -r <tag> -r <tag> <files>

Check-in a file

cvs <commit|ci> [-m "log message"] <file>

Indicate that a set of files are no longer in use

cvs release [-d] <cvs-dir>

-d: delete the working copies
Release messages
  • ? <file>   # The file is not in CVS (common message for generated files)
  • M <file>   # The file has been changed since it was checked out

Adding tags

CVS tag -[dF] <tag> [-r <tag>] <files>

-d    Delete the specifed tag
-F    Move tag if it already exists
-l     Local (non-recursive)
-R    Recursive

Administration

Create a repository

cvs [-d <cvsroot-path>] init
  • To avoid having to use the "-d <cvsroot-path>" option, add the following line to .profile or .bashrc
  • init doesn't overwrite any existing files
export CVSROOT=<cvsroot-path>

Import a project into CVS

# Import the project in the current directory into <cvs-dir> (recursively).
cvs import -m "Imported sources" <cvs-dir> <vendor-tag> <release-tag>

Add a directory

cvs add <cvs-dir>

Add a file

cvs add <file>
cvs <commit|ci> [-m "log message"] <file>

Remove a file

cvs remove [-f] <file>
cvs <commit|ci> [-m "log message"] <file>
  • Use of the -f option for cvs remove automatically deletes the working copy of the file.

Remove a directory

  • There's no way to remove a directory in CVS.
  • Use the -P option when checking out files, to avoid creating empty working directories.

Rename a file

mv <old> <new>
cvs remove <old>
cvs add <new>
cvs <commit|ci> -m "Renamed <old> to <new>" <old> <new>

Terms


Repository
  • The master set of files (as opposed to a working copy of the files)
  • $CVSROOT is the location of the central repository
Module
  • A project, a related set of files within a repository
  • Defined in the 'modules' file

Files

Repository

  • $CVSROOT/CVSROOT   # Administrative files
  • $CVSROOT/gnu   # Utilities
  • $CVSROOT/<module>
  • $CVSROOT/<module>/*,v   # History files



Resources
  • CVS - gnu.org
  • Ximbiot   (unable to access portions of the website)
Sources
  • http://ximbiot.com/cvs/manual/