I. CVS (Concurrent Versions System)

CVS (Concurrent Versioning System) is a "version control" program that keeps track of the changes you make in your code. This is a brief cheatsheet on using the command-line interface to CVS. You can find more detailed tutorials and such at cvshome.org.

    * To create a project:
      Navigate into the base directory of the project you want to store in CVS, then issue the command below. CVS will then add all the files and subdirectories into the new repository. cvs -d cvsroot_path import project_name vendor_name release_tag
    * To checkout files:
      cvs -d cvsroot_path checkout module_name_or_path
    * To commit changes:
      cvs commit
      CVS will commit all changes in the current directory and below, so be in the top directory you want to commit.
      CVS stores the repository path, so you don't need to enter it again.
    * Update the sandbox:
      cvs update -d
      The update will update your working files to the latest committed files.
    * Adding files to a repository:
      cvs add filename
      The file or directory will be added a the next commit command.
    * Removing files from repository:
      cvs remove filename
    * Releasing the checked-out code:
      cvs release project_name
    * Comparing your code to the original / archived code:
      cvs diff filename

CVS works on entire directories at once, possibly checking in multiple changes in multiple files, recursing into directories 
and picking up changes there, too.

CVS actually uses RCS on the backend, so it's convenient sometimes to start with RCS until the overhead of using RCS 
independently on each file is too great and then migrate into CVS.


* The basic CVS commands are:

cvs checkout $module - initial checkout to your working directory
cvs add $file - add $file to current branch in repository
cvs rm $file - remove $file from the current branch in repository
cvs commit $file - commit changes to $file (or all if $file is null)
cvs update $file - check out new files from repository to current dir 



II. RCS

1. check out and lock the file: co -l filename
2. make changes to the file as needed
3. check in and unlock the file: ci -u filename
4. add comments, end with a period on a line by itself.



First, to recognize that a file may have RCS version control, look for a $filename,v.
It could be sitting there next to the file in question or inside an RCS directory: RCS/$filename,v

Then to manipulate the file use the commands:

ci - checkin
co - checkout
rcsdiff - diff
rlog - view log

Like this:
echo 'first revision' > somefile
ci -l somefile
somefile,v  <--  somefile
enter description, terminated with single '.' or end of file:
NOTE: This is NOT the log message!   
>> this is a demo file
>> .
initial revision: 1.1
done


The NOTE only appears on the first checkin, to let you know you're not giving a change log message, but a description of the file.


perl -i -plne 's/first/second/' somefile
ci -l somefile
somefile,v  <--  somefile
new revision: 1.2; previous revision: 1.1
enter log message, terminated with single '.' or end of file:
>> changed 'first' to 'second'
>> .
done


There, we've created an RCS trail for the file. You can use rlog to view the log which shows how many revisions, 
by whom, and when. You can also use rcsdiff to see what was changed between the disk copy and the last (called head by RCS) copy in the RCS journal.