Thursday, June 28, 2007

CVS FAQ's

Setting the CVS PATH for executing binaries :
For Bash shell:
$export PATH=$PATH:/opt/cvs/bin
Setting up CVSROOT :
$export CVSROOT=:pserver:sriram@unixbox:/usr/local/cvsroot
If possible, set it once and for all using UNIX script
executed on login, such as /.cshrc or /.bashrc.
Logging in to CVS:
$ cvs login
CVS password: (enter your CVS password here)
The records are stored, by default, in the file '$HOME/.cvspass'.(encrypted).
You can change the default by changing CVS_PASSFILE environment variable.
CVS Checkout :
Given a properly configured CVS server, checkout will extract a working copy of the files
associated with the module into the current working directory:
cvs -d /usr/local/cvsroot checkout dirname

To properly remove a local working copy:

cvs release -d $DIRECTORY

Add a File to CVS

$ cvs add backend.c
$ cvs commit -m "Early version. Not yet compilable." backend.c

To Save changes to the repository :

In case that you have the authorization, you can commit changes in your local working copy directly to the repository.

cvs commit
cvs commit filename(s)

Set up email notification of changes committed to the repository:
Just add a line like this to the CVSROOT/loginfo file:
DEFAULT mail -s %s usergroup@company.com
Logout to CVS:
$CVS logout
If you have not setup environment variable then:
cvs -d ":pserver:sriram@yourhost:/opt/home/cvs" command
cvs -d ":pserver:sriram@yourhost:/opt/home/cvs" login

To give users access to only read permission on CVS repositories :

There are two ways to specify read-only access for a user: by inclusion, and by exclusion.

Inclusion:
Create a file named readers in your CVSROOT directory
Sample readers file
$cat '$CVSROOT/CVSROOT/readers'
sriram
rakesh
mahesh
Exclusion:
"Exclusion" means explicitly listing everyone who has write access--if the file
$cat '$CVSROOT/CVSROOT/writers'exists
then only those users listed in it have write access, and everyone else has read-only access.
CVSROOT has the following format:
[[:protocol:][[user][:password]]][@servername][:serverpath]
Protocols :
:local - Here the repositories are located or on NFS, this is not recommended.
:pserver - pserver protocol is client/server scheme protocol, unsecured not recommened on
public networks.
:ext - access cvs using ssh (encoded).
For example :
$export CVS_RSH=ssh
$export CVSROOT=:ext:sriram@unixbox:/usr/local/cvsroot
Their also exists some other protocols but their usage is specific
and seldom.
Please see the List of CVS environment variables here