CVS overview

RCS ident


Use //$Header$

Creating a new repository:


setenv CVSROOT	$HOME/cvs	// update .profile, .cshrc or whatever
cvs -d $CVSROOT init

Creating a project/module:


cd project			// assume all files are under .
cvs import project DV initial	// repository will be in $CVSROOT/project
				// DV is ``vendor name'' [necessary]
				// initial is initial tag (release name)
cd ..
rm -fr project			// remove old stuff

Checking out a project/module:


cvs co project			// will create project/

Releasing a project/module:


cd project
cd ..
cvs release -d project

cvs co CVSROOT/modules		// checkout modules file
cd CVSROOT
vi modules			// add line "project	DV/project"
				// on a later co project, a directory ./project will
				// be recreated
cvs ci modules			// commit modules file
cd ..
cvs release -d CVSROOT		// remove CVSROOT/*

Removing a file:


cd project			// ``file'' is file to be removed
rm file
cvs remove file			// tell CVS you want to delete the file
cvs ci file			// actually perform removal

Removing a bunch of files:


cd project
rm *.o
cvs remove			// will find out files that disappeared
cvs ci -m "removed *.o files"

Removing a directory: imppossible, just remove files.

 cd project
 cd newdir			// suppose dir contains a and b
 rm a b
 cvs remove
 cvs ci
 
Using the -P option with cvs co or cvs up will not copy empty directories.

Resurrecting a file:


cd project
cvs add junk.o			// will resurrect the file

Adding a file:


cd project			// you MUST be in newfile's directory
touch newfile
cvs add newfile			// is NOT recursive

Adding a binary file:


cd project
cvs add -kb -m "Added t.o" t.o	// -kb turns off keyword expansion
cvs ci -m "Added t.o" newfile

Adding a directory:


cd project
mkdir newdir
touch newdir/a
touch newdir/b
cd newdir
cvs add newdir
cd newdir			// you cannot do ``cvs add newdir/*''
cvs add a b			
cvs ci

Moving, renaming files:


cd project
mv old new
cvs remove old
cvs add new
cvs ci -m "moved old->new" old new

Moving, renaming directories:


cd project
mkdir new
cvs add new
mv old/* new
cd old
cvs remove
cvs ci
cd ../new
cvs add *
cvs ci

Getting log information:


cd project
cvs log Makefile		// show Makefile status
cvs log ../project		// show status of all files

Getting checkout information:

cvs history -o			// show checked-out modules

Getting annotated version of a file:

cd project
cvs annotate Makefile		// Each line has author, date, revision

Synchronizing your version:

cd project
cvs update

Giving a name to a release:

cd project
cvs update
cvs tag release-1

Retrieving a tagged release:


cvs co project -r release-1

or

cvs update -r release-1

Notifying and enforcing cvs edit

  1. Check out ${CVSROOT}/CVSROOT
      cvs co CVSROOT
      
  2. Create a file users in ${CVSROOT}/CVSROOT where each line specifies a user username:emailaddress (no spaces) where username is the name of a local user and emailaddress is an address to where notifications should be sent. (Of course the machine with the ${CVSROOT} should support sending mail).
      cd CVSROOT
      cvs add users
      cvs ci
      
  3. Add a line to ${CVSROOT}/notification:
      ALL mutt -s "CVS notification" %s
      
  4. The following should be executed in the directory containing the files for which notifications should be send (and 'cvs edit' enforced).
       cvs watch on # 'enforces' use of cvs edit, files are checked out read-only by default
       cvs watch add # add current user to list of users that receive e-mail
      
    Actually, the cvs watch add command does not seem to work on files that are added in the future to this directory. An easy way to fix is to manually edit the ${CVSROOT}/module/CVS/fileattr file.
       cd ${REPOSITORY}/module
       vi CVS/fileattr
       # edit the line that starts with 'D' (directory)
       # it should look like this (compare with exsiting 'F' lines)
       D_watchers=user1>edit+unedit+commit,user2>edit+unedit+commit;_watched=
       # where user1, user2 are user names (as in the 'users' file)
      
To check who is editing/watching
cvs editors filename
cvs watchers filename
An alternative (e.g. to avoid users forgetting to cvs watch add): create an e-mail address allusers@machine.domain that sends to all users and have a single line
	yourname:allusers@machine.domain
in ${CVSROOT}/users.

Ensuring that the group owner of the cvs directories remains correct

find $CVSROOT -type d -exec chmod g+s \{} \ ;
See also here (local txt copy) for more on this and similar problems re. sharing access.
Dirk Vermeir (dvermeir@vub.ac.be) [Last modified: Wed Jan 2 20:52:34 CET 2008 ]