CVS Usage Notes
I have pretty much stopped using CVS for any of my own developing. I typically use Subversion instead. The only thing I use CVS for any more is my Debian packages, through a program called cvs-buildpackage.
However, I do have a few notes related to CVS hanging around, and it might be nice to have them listed here.
Before you look at much else, take a look at the CVS Home Documentation. The Cederqvist is worth your time. Otherwise, skim the Introduction to CVS and make sure you understand how to add files and update and commit a directory. Get in the habit of always doing an update immediately before a commit. Getting in this habit now, when you aren't necessarily sharing a repository with anyone, will save you pain later when you are.
Remember, CVS does not have explicit locks like RCS or Clear Case. If you can see a file, you can edit it. You resolve conflicts at commit time or when you update your working directory.
That there are a lot of things you can do by sidestepping CVS and working directly with the filesystem (like, er, permanently removing files from revision control). In fact, there are some things (such as renaming a directory or a file while preserving history) that can only really be done "right" (IMHO) by sidestepping CVS. This is a pain. If you don't like it, start using Subversion instead.
To import a directory using the EXT method, do something like this:
cvs -d :ext:user@host:/path/to/cvs import -m "Initial import" project author project_v1-0-0
Check out an existing directory using:
cvs -d :ext:user@host:/path/to/cvs checkout project
You'll probably have to set $CVS_RSH in your environment to make this work:
CVS_RSH=ssh
You may also choose to set $CVSROOT:
CVSROOT=:ext:user@host:/path/to/cvs
Check the book for details.
Oh, this caused me a headache tonite. I was working on XMLTV, in the libxmltv-perl-0.5.2 subdirectory. The previous release was:
libxmltv-perl_debian_0_5_2-3
I had changed four files to build a patch for upstream, and then they rejected the patch, so I had to back it out. Now, what I should have done was branched, so I could throw out or ignore the branch, but I didn't. Instead, I committed the changes and tagged them as:
libxmltv-perl_bug_169157-2
Ok, how do I throw out my intermediate changes? I can do this by hand (i.e. check out an old version, save off the old version, check out a new version, and then copy over the top), but that's clunky and it would be a real pain if I had to do it for a lot of files. I finally figured out that I can do this:
cvs co -j libxmltv-perl_bug_169157-2 -j libxmltv-perl_debian_0_5_2-3 xmltv
This is supposed to give me a working copy with the changes between the two bugs removed (note the order - last tag first). And indeed, if I go into the new checked out directory, I can use:
cvs diff -r libxmltv-perl_debian_0_5_2-3
and see no differences. Perfect. If I commit this directory as is, without even touching it, HEAD now exists with my changes reversed out. If I have another directory for xmltv already (a different sandbox) I can do
cvs update -A
to force the latest version of everything in that sandbox.
Oh, and if you can't remember what you tagged something, it appears that CVSROOT/val-tags contains the tags you've used.