The Absolute Minimum on Installing and Using CVS
These are the simple steps that I used to get myself up and
running with CVS. They are the very minimum steps, with little in
the way of explanation. Please refer to the many good resources on
CVS for more detailed and comprehensive information:
- The Cederqvist
Manual
- The
Redbook Manual
- WinCVS Daily Use
Guide: WinCVS is a GUI CVS client for Windows
- CVSGui
- The CVSNT
Wiki: CVSNT is a CVS server for Windows NT
- DevGuy's CVS
Information Helpful guide to CVS, including CVSNT
installation
-
SourceForge's Basic Introduction to CVS
-
SourceForge's Introduction to CVS for Developers
Bear in mind that the CVS program consists of two main
components: the server daemon/service, and the client. CVS can be
used on a standalone machine such that the repository and the
working-copy are stored separately on the same computer. In
addition, it can be used over a network such that the daemon/server
and the repository are on the remote machine and the client and
working-copy (or sandbox) are on the local workstation. Network
operations involve user names and passwords, so a variety of
protocols, of varying levels of security are available.
Also see my notes on WinCVS.
CVSROOT
CVSROOT is a core aspect of CVS, referring, in general to the
location of the repository, and possibly the protocol used to
connect to it. Be careful when using the word CVSROOT; it can mean
the following different things:
- The directory that contains the repository.
- The variable that indicates which repository CVS commands
operate on.
- The name of the administrative directory within the
repository.
The -d cvsroot option of the cvs command is used
to indicate which repository to use. However, to avoid having to
enter this with every CVS command, you can use an environment
variable named CVSROOT (e.g.: export
CVSROOT=/usr/local/cvsroot/ for Unix). If you have set such an
environment variable, you can override its value temporarily
(presumably to use a different repository) using the -d
option.
For remote repositories, it is necessary to specify both
the machine that holds the repository, and which protocol to use, in
addition to specifying the repository directory. On the local
computer, the CVSROOT variable contains at least the path to the
repository, and may contain the following:
- connection method, surrounded on each side by a colon (e.g.
CVS's built-in method pserver, ssh for
security, or sspi for Windows)
- user name for logging in to the remote machine, suffixed by
the ‘@’ symbol
- server name, optionally suffixed by a colon
On Windows machines, the sspi protocol is convenient and secure.
A typical CVSROOT in this case could be:
:sspi:psy.swan.ac.uk/cvsrepo
If you are not using a built-in protocol, you may need to specify
the program CVS should use to connect to the server. This can be
done by setting an environment variable named ‘CVS_RSH’
with a value corresponding to the name of the client program that
supports the relevant protocol. On Windows clients,
Plink.exe, which comes with PuTTY can
be used for this purpose. Note that the directory path should
contain forward slashes, even if both the client and server
are Windows machines. A fuller example of a CVSROOT variable
follows:
:pserver:cartern@psy.swan.ac.uk:/usr/local/cvsroot
Installing CVS
The operations described next are performed on the machine that
contains the repository. In the case of a networked system, this
would be the server machine; the programmers work on their own
workstations, using the CVS client to communicate with the
repository.
- Create a directory to hold the CVS repository. This directory
is called “cvsroot”, and is typically located in
/usr/local/cvsroot/ or c:\cvs\cvsrepo\ on
Windows.
- Make a group named cvsusers (edit
/etc/group or use User Manager on Windows)
- Add the appropriate users to the cvsusers group (edit
/etc/passwd)
- Change the owning group of the cvsroot directory to the
cvsusers group (e.g. chgrp <cvsroot> cvsusers,
not necessary on Windows)
- Change the permissions of the cvsroot directory so that the
cvsusers group can write to it (e.g. chmod <cvsroot>
g+w or right-click on the directory in Windows, and use the
security tab to give Modify permissions to the cvsusers
group.)
- Initialise the cvsroot directory with the command cvs
init -d <cvsroot>.
Using CVS
- If you are using CVS with a password protected username, you
need to use the command cvs login <username> and
then issue the password. Use cvs logout when you have
finished using the repository.
- To add a new project to the CVS repository:
- Move into the directory containing the files you wish
to place into CVS
- Use the command cvs import -m "<log
message>" <module name> <author>
<release>. Note that CVS will add all files in
the current directory and all subdirectories, so you may
want to delete or move any files that need not be
permanently stored with CVS. Note also that the module name
will be used as the directory name for the module when it
is stored within the cvsroot directory.
- Now delete or rename the directory that you just added
to CVS. This is because this copy of the files is not
actually under CVS control.
- Obtain a CVS–managed copy (known as a
“sandbox”) of the files for the relevant
project from CVS with the command: cvs checkout
<module name>. Note that CVS will generate the
sandbox as a subdirectory of the current directory.
- If you want to discard the changes you've made a to a file
(and revert to the previous version stored within CVS), delete,
move, or rename the file, and use the command cvs
update in the relevant directory.
- To store the changes you've made to a file since the last
checkout, use the command cvs commit <filename>.
If you don't enter a filename with the commit command, cvs will
commit all changed files.
Content last updated: 2007-01-05