Using command-line CVS to access project source files

Getting started with CVS

If you are participating in a development project on this site, you must use CVS as the versioning control tool for project source files. This the first in a series of three tool documents covering information and commands pertinent to using CVS.

Accessing a project's CVS repository

If you do have cvs login access for a project hosted on this site, first you must set the cvsroot to access the project's source code repository. In your shell or terminal client, type:

:pserver:yourlogin@cvs.projectname.domain.com:/home/main_cvs_dir

substituting your login and project information.

If you are only working on one project at a time, you only have to set cvsroot the first time you log in to CVS.

If you are participating in more than one project and need to access CVS repositories located on different servers, you need to set the cvsroot for each login session access the correct project's source repository.

If you do not have a specific cvs login but wish to look at an open source project's source repository, you may still be able to log in to cvs as "anonymous" by typing:

:pserver:anoncvs@cvs.projectname.domain.com:/home/main_cvs_dir

To log in to CVS, use the following command:

cvs login

Enter your user password when prompted. This should be the same password associated with your user account on this site.

Getting source files

To get a "working copy" of the latest source files, you must check out the source files, a process which copies the files onto your system. First create a directory on your local machine by typing:

   mkdir my_working_dir (the directory name of your choosing)
   cd my_working_dir
 

Then, to check out or copy source file from the repository into your newly created local directory, type:

cvs checkout project_name

This top-level module would contain the entire source code tree (that is, the top level directory and any subdirectories) for that part of the project. There is a fairly common module structure for project CVS repositories initially. As the project grows, the project's source "tree" also grows as subdirectories are added to various modules.

To obtain the source code for a particular module called "module-name" within the project named "project_name", specify:

cvs checkout module_name/project_name

More about checking out a working copy of project files

Viewing file revision history

Anyone with cvs read permission can view individual file histories to track revision information by typing:

cvs log filename

The result is a display of the file's revision information, starting with the most current revision, and includes such information as the log message, status, working revision number, and repository revision number.

Comparing file revisions

To see the particulars of a file's modifications between two revisions, after obtaining file revision numbering information from the "cvs log" command's output, type:

cvs diff -r revision_# -r revision_#

The entire file contents display with lines from both versions where differences occur marked by revision number.