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:[email protected]:/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:[email protected]:/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.

Watching files in the CVS repository

You can turn on the "watch" command to tell CVS that you want to receive notifications about actions taken on a file. Too add the current user to the list of people to receive notification of work done on files enter:

CVS watch add -a [action] -l [files]

The -a option specifies what kinds of events CVS should notify the user about. The -a option may appear more than once, or not at all. If omitted, the action defaults to all. Action is one of the following:

edit
Another user has applied the CVS edit command (described below) to a file.
unedit
Another user has applied the CVS unedit command (described below) or the CVS release command to a file, or has deleted the file and allowed CVS update to recreate it.
commit
Another user has committed changes to a file.
all
All of the above.
none
None of the above.

The files and -l option are processed as for the CVS watch commands.

To remove a notification request established using CVS watch add, the arguments are the same:

CVS watch remove -a [action] -l [files]

If the -a option is present, only watches for the specified actions are removed.

When the conditions exist for notification, the users will receive an email from the SourceCast server notifying them of the action performed on the files they are watching.