CVS Cheat Sheet

To use CVS properly, you should (must) have an SSH agent with your SSH key, and have your SSH public key in your .ssh/authorized_keys file on our CVS server. Test using ssh cvs.bcl.hamilton.ie pwd. No password should be needed!

The online text Open Source Development With CVS is an excellent reference.

CVS Dos and Don'ts

Useful Commands

Check out local copy

rm -rf meg
export CVS_RSH=ssh
cvs -d :ext:cvs.bcl.hamilton.ie:/home/cvs checkout meg

Commit your changes to the repository

cvs commit -m 'add --help switch' foo.c

Integrate other people's commits (if any) into your copy

cvs update foo.c

Delete a file from the repository

rm foo.cc
cvs remove foo.cc
cvs commit -m 'contents moved to file bar.cc' foo.cc
Note that the file's past continues to exist in the repository, so you can fetch old versions, examine its log, etc.

History

Difference between file in sandbox and head version in repository.
cvs diff file.cc
Examine history of a file. Works even if file is deleted in current version.
cvs log file.cc | more
Difference between specified versions.
cvs diff -r1.23 -r1.24 file.cc
Request particular version from repository. Works even if file is deleted in current version.
cvs update -r1.23 file.cc
Request head version from repository.
cvs update -A file.cc

Drop local changes

rm file.cc
cvs update file.cc

Symbolic labels

Label current version in repository with symbolic tag.
cvs tag handin-28-Jan-2001 foo.c bar.c foo.h bar.h Makefile

Set a watch

These arrange to send you email every time someone commits a change to the file foo.cc (first line) or any file in or below the directory in question (second line).
cvs watch add foo.cc
cvs watch add
Note that you probably need to create a file ~/.forward containing your preferred email address on the CVS server. Eg:
echo my_email@address.ie | ssh cvs.bcl.hamilton.ie "cat > ~/.forward"

Emacs and CVS

Emacs has a nice interface to CVS. You check things out from outside emacs, but when editing it rocks. The modeline displays the CVS revision number. To talk to CVS do
  M-x cvs-update
In the resulting *cvs* buffer go C-h m for documentation on available commands.

Important *cvs* buffer commands:

  a             add
  c             commit, then C-c C-c in the resulting log entry buffer
  d d           diff against repository
You can also use version control commands while in the buffer with the file itself.
  C-x v =      diff against repository
  C-x v l      show log of change history
  C-x v v      commit changes, then C-c C-c in resulting log entry buffer

Random Information

Here are random tidbits of information useful only under special circumstances.
last update: $Date: 2007-12-18 11:17:41 $