CVS

From LQWiki
Jump to navigation Jump to search

Concurrent Versioning System (CVS), is a client-server version control (aka revision control) system. It enables teams to write together on books, documentation - or software projects. CVS's client tools are available on most platforms.

It works like this: There is a central storage for the files, called the Repository. Every participant can check out (download) the project's files to their local Sandbox and change them. Some select participants can commit (upload) their changes back to the repository. The technical excellence of CVS is, first, that for every file in the repository, there is every version available. This is not because every version is stored, but because every change is stored. See revision control. Second, it is totally transparent whether your repository lives on a remote server or on your local desktop.

CVS is in many aspects outperformed by subversion, but CVS is still easier to set up.

Usage

Building up a server

To build up a CVS Server, best use webmin that has an own module for that.

Creating a repository

To create and initialize a repository /cvstest, do a

cvs -d /cvstest init

Accessing a repository

Before you can do anything, you must tell CVS the location of the repository you'll be accessing. This is done with the -d global option. For example, assuming the repository is on the local machine in /usr/local/cvs (a fairly standard location):

$ cvs -d /usr/local/cvs cvs-command

You can also use the variable CVSROOT to avoid the -d option. E.g. You can check out the files from the very same repository by:

$ export CVSROOT=/usr/local
$ cvs co cvs

In many cases, however, the repository is on another machine and must therefore be reached over the network. CVS provides a choice of network access methods; which one you'll use depends mostly on the security needs of the repository machine.

To specify a remote repository as opposed to a local one, you just use a longer repository path. You first name the access method, delimited on each side by colons, followed by the username and the server name (joined with an @ sign), another separator colon, and finally the path to the repository directory on the server.

An example of the pserver access method, which stands for "password-authenticated server":

$ cvs -d :pserver:jrandom@cvs.foobar.com:/usr/local/cvs login
(Logging in to jrandom@cvs.foobar.com)
CVS password: (enter your CVS password here)
$

The command to check out a project is exactly what you think it is:

$ cvs checkout myproj
cvs checkout: Updating myproj
U myproj/README.txt
U myproj/hello.c
cvs checkout: Updating myproj/a-subdir
U myproj/a-subdir/whatever.c
cvs checkout: Updating myproj/a-subdir/subsubdir
U myproj/a-subdir/subsubdir/fish.c
cvs checkout: Updating myproj/b-subdir
U myproj/b-subdir/random.c

$ ls
myproj/      was_myproj/
$ cd myproj
$ ls
CVS/        README.txt  a-subdir/   b-subdir/   hello.c
$

source: http://cvsbook.red-bean.com/cvsbook.html

See also

External links