DNA Cafe | Download | FreeSoftware | Java | Links

DNA - FreeSoftware - CVS

CVS is a version control system, which allows you to keep old versions of files (usually source code), keep a log of who, when, and why changes occurred, etc.

The first thing to understand is that CVS stores all files in a centralized repository.


The repository

The CVS repository stores a complete copy of all the files and directories which are under version control. Normally, you never access any of the files in the repository directly.

Initialize repository

Initialize a repository by adding the CVSROOT subdirectory and some default control files. You must use this command or initialize the repository in some other way before you can use it.

$ mkdir CVS_root_directory
$ CVSROOT=CVS_root_directory
$ export CVSROOT
$ cvs init

Import source distribution into repository

To bootstrap new sources into the source repository as vendor branch.

$ cd source_distribution_directory
$ cvs import repository vendor_tag release_tag ...

Snapshot

Specify a symbolic tag for files in the repository, uses working directory.

$ cvs tag tag

Make branch

Explicitly specify a symbolic tag for particular revisions of files in the source repository.

$ cvs rtag -b -r existing_revision_or_tag branch_tag modules

Rename branch

$ cvs admin -n new_branch:old_branch


The typical work-session

The first thing to understand is that CVS stores all files in a centralized repository.

Checkout modules

$ mkdir work_directory
$ cd work_directory
$ cvs checkout -r revision_or_tag modules

Add directory on repository

$ cvs add directory

Add file on repository

$ cvs add file

Delete file on repository

$ cvs remove -f file

Rename file on repository

Please see CVS FAQ. Because 'rename' doesn't mean single way, you know?

Update modules

$ cvs update -d -r revision_or_tag

Show differences

$ cvs diff [-c] [-r revision_or_tag [-r revision_or_tag ...]

Commit chenged modules

$ cvs commit

Cancel checkout

$ cvs release


Password-Authenticating Server

On the server side, inetd knows to run the command cvs pserver when it receives a connection on the right port.

Put a line like this into each file (after checking to make sure it isn't already there):

/etc/services
cvspserver 2401/tcp
/etc/inetd.conf
cvspserver stream tcp nowait root /usr/bin/cvs cvs -f --allow-root=path pserver
/etc/hosts.allow
cvs: LOCAL

If you use xinetd such as RedHat, put configuration file for cvs pserver.

/etc/xinetd.d/cvsserver
cvsserver configuration file

And send SIGHUP signal to reread its configuration file.

Next, put a password in the CVS passwd file. This file is `$CVSROOT/CVSROOT/passwd'. Here is an example file:

CVSROOT/passwd
anonymous:
daisuke:tGX1fS8sun6rY
someone:1sOp854gDF3DY:pubcvs

It is normal to edit the `passwd' file in-place. This is because of the possible security risks of having the `passwd' file checked out to people's working copies.

(Here is a simple program to make encrypted entries. → cvspasswd.tar.gz)

And check out CVSROOT to edit configuration files.

$ cvs checkout CVSROOT

CVSROOT/config
SystemAuth=no
CVSROOT/readers
anonymous
daisuke
someone

CVSROOT/writers
daisuke
someone

And commit it.

$ cvs commit


Server using ext method via SSH

CVS use the `rsh' protocol to perform these operations.

In server side, create new users to access repository. Add cvs group, and include users this group.

If you have a server which you only want to allow users without providing shell access, you can use rssh to do that.

$ groupadd -g 1234 cvs
$ useradd -s /usr/local/bin/rssh user
$ vigr

For example, group as follows:

/etc/group
cvs:*:1234:user

Change group ownership and file permissions to access repository.

$ cd CVS_root_directory
$ chgrp -R cvs .
$ chmod ug+rwx . CVSROOT

Connect to repository

On the client side, you will need to set up two enviroment variables as follows:

$ CVS_RSH=ssh
$ CVSROOT=:ext:user@host:path
$ export CVS_RSH CVSROOT
$ cvs command


Reference

http://ximbiot.com/cvs/wiki/
Ximbiot - CVS Wiki
http://www.viewvc.org/
ViewVC: Repository Browsing
http://cvsgui.sourceforge.net/
CvsGui.org

Vector Valid XHTML 1.1! Valid CSS!