CVS commands are issued by typing cvs, followed by a list of global options (if any), followed by the desired cvs command name, followed by a list of options specific to that command (if any). Below are some commonly used commands and examples of how they are invoked. A CVS command can apply to a single file, a directory or the whole repository.
If entering cvs alone results in a "command not found"
error, type /usr/bin/cvs.
Obtain an editable version of a file(s) from the repository. Can be abbreviated as co.
Checkout the entire tree; invoke where the
src and doc directories are to
be created
Checkout the HEAD (the tip of the tree) revision of a specific file; invoke at the top of the working tree, where src and doc subdirectories reside or where they are to be created. Invoking this command in the subdirectory where the file resides, or without giving the path specification as indicated, will not work.
Checkout a tagged revision of a specific file; invoke at the top of the working tree, where src and doc subdirectories reside, or where they are to be created.
Bring the working directory up to date with the repository. This
command replaces files in the working directory if a more recent
version of the file exists in the repository and the local copy is
unchanged. If the repository contains a revision more recent than the
ancestor of the local copy, and the local copy has been modified, this
command attempts to merge the latest revision in the repository with
the local copy. It is a good idea to first run this command with the
-n global option. Running update with the
-n option causes cvs to tell you would it would do
without modifying any files. It is best to issue this command by
piping its output to a file so that all files in which a conflict
occurred can be reliably identified. If conflicts arise, cvs indicates
this with a 'C' in the output. Running update prior to checking in
files is strongly recommended to ensure that someone else's changes
are not over-written.
Find out what cvs would do if the update command
were issued; invoke in the top level directory (where
src and doc reside), and redirect output to a file.
Option -A resets any sticky tags,
-P prunes empty directories, and
-d creates any directories that exist
in the repository if they are missing from the working
directory.
Do the update for real. Options same as above. The output of this command is:
RCS file: /proj/cdsp/biomed2/cvsSCIRun/src/Core/Datatypes/TriSurfMesh.cc,v retrieving revision 1.2 retrieving revision 1.3 Merging differences between 1.2 and 1.3 into TriSurfMesh.cc C Core/Datatypes/TriSurfMesh.cc RCS file: /proj/cdsp/biomed2/cvsSCIRun/src/Core/Datatypes/TriSurfMesh.h,v retrieving revision 1.2 retrieving revision 1.4 Merging differences between 1.2 and 1.4 into TriSurfMesh.h M Core/Datatypes/TriSurfMesh.h U Core/Datatypes/TypeName.h ? Core/Datatypes/TriSurfMesh.cc.1.2
The character at the beginning of certain lines indicates the result of the update. The "C" indicates that cvs tried to merge two revisions and encountered conflicts, which are highlighted by the standard diff demarcations. Manual resolution is required. "M" means the files were merged successfully, "U" means the file is unchanged, and "?" means there is no record of the file in the repository.
To schedule newly created file(s) to be added to the repository, there must be a working copy of the new file. The add command is used to tell CVS about the new file (see the manual for instructions on adding new directories). The add command must be invoked from the directory in which the new file exists. Then run the commit command to check the file into the repository. For example:
cvs add filename
Incorporate changes from the working directory into the repository. commit is abbreviated as ci.
When checking in files, cvs will prompt for comments
using the vi editor, unless otherwise specified. To avoid
vi, set the EDITOR environment variable to
point to an editor. For example:
setenv EDITOR emacs
The command:
cvs ci TriSurfMesh.cc
commits the working version of a file, making it the HEAD (tip of the tree) revision; typically invoked in the directory where the file resides without any path specification (not sure if it can be run any other way). CVS will automatically assign the next internal revision number to the file upon checkin.
The -m option can be used to avoid
being put into an editor:
cvs ci -m"this is my checkin comment" TriSurfMesh.cc
Create a patch file for use by SCI to incorporate changes made locally into the next official release. See manual for details.
View log information about a file, such as revision numbers and check in comments. Most conveniently invoked in the directory in which the file of interest resides, e.g.:
cvs log TriSurfMesh.cc