Adnan's CVS nanotutorial

MOTIVATION

cvs was developed as a version control system for software
development, wherein multiple developers could work on
a source tree simultaneously.  i've found cvs to be very useful
for writing documents - in addition to allowing multiple
people to work on a paper, cvs allows me to create local
copies of the files comprising a paper, and easily
makes changes across the network.

there's no locking in cvs - two people can simultaneously
be working on their own copies of a file.  this is not a
problem, indeed its one of cvs' most appealing features:
cvs will intelligently merge the files.  it will mark places 
in the file where it couldn't reconcile differences, and 
keep both versions.

if all you are doing is working with an existing repository,
you can jump to the part titled USING AN EXISTING REPOSITORY.


AT THE VERY BEGINNING

 o create a cvs "home" directory (a repository), e.g.,

  - mkdir /home/ecelrc/faculty/adnan/cvs


 o set the CVSROOT environment variable from the shell

  - setenv CVSROOT /home/ecelrc/faculty/adnan/cvs

    and then initialize by running

  - cvs init

the above two items are done only once - all future projects
have their repositories in the cvs home dir created above.


CREATING A CVS REPOSITORY

 o importing a directory into CVS: to add the directory ~/public_html/FAC to the 
   repository, go to ~/public_html/FAC and run the import command

  - cvs import -m "random mesg" FAC foo bar 
    (the foo and bar are some random tokens, don't bother about them)

   at this point you may want to delete ~/public_html/FAC so that you don't edit
   those files by mistake - they cannot be easily merged into the cvs repository!


USING AN EXISTING REPOSITORY

 o checkout: get a repository by running

  - cvs checkout FAC

    in the directory of your choice.  (e.g., in ~adnan/papers/ - this
    will create the directory FAC in ~adnan/papers, and the directory
    will include all the FAC files.


 o update: to bring things at your copy in synch with the other ones,
   run update from the directory where you've checked stuff out to with

  - cvs update


 o commit: add your changes back to the repository by running commit
    in the directory with all the files you've worked on with

  - cvs commit

   if you want to work on a local machine (in this example,
   not sunfire) you can do the following (assuming your user id is amit):


 o deleting files: you can remove files and directories from the repository 
   by first removing them from the local directory, then (assuming we're deleting 
   foo.tex) running

   - cvs remove foo.tex
 
   if you delete a directory and later do a checkout, you get that (empty) directory
   back - cvs needs to keep the directory around for revision control.  you can tell 
   cvs not to bring in the empty directories with the -P flag when you run update or 
   checkout.


 o adding files: you can add a file or a directory by running

   - cvs add bar.tex


 o checking changes: you can see how your file(s) differ from those in the repository

   - cvs diff foo.tex bar.tex  
   - cvs diff .  # all files in local directory


RUNNING CVS REMOTELY

  - cvs -d amit@sunfire.ece.utexas.edu:/home/ecelrc/faculty/adnan/cvs checkout id-infocom-04

    make sure to setenv CVS_RSH ssh (in tcsh syntax) before starting. 

    once you've got a local copy you can run cvs commit or cvs update without typing in 
    the long "-d amit@sunfire.ece.utexas.edu:/home..."

    you'll need to either have the cvs executable on your path on the remote machine,
    or set the CVS_SERVER environment variable on the local machine to the absolute path
    to the executable on the remote machine (e.g., setenv CVS_SERVER /usr/local/bin/cvs
    if the remote machine is sunfire.ece.utexas.edu) 
 

ADDITIONAL RESOURCES

  - Detailed documentation at www.cvshome.org