CVS Lesson (CBMG688P, Best Practices laboratory, Stoltzfus)

In this lesson, you will learn to use a tool called "CVS" (Concurrent Versioning System) to maintain a repository with versions of code (or other) files.

background

Specifically, you will be the creator and owner of a CVS repository in your home directory. This approach is easy and it gives you complete control. However, for future reference, doing things this way is a poor choice if you want to collaborate. In that case, use github or a project hosting site such as sourceforge, or ask your sysadmin to set up a CVS repository that others can access via the internet: you can access that using the same CVS commands we are learning in this exercise (but your sysadmin will give you a CVSROOT that refers to some other computer on the internet).

exercise

hint:use cut & paste, or TAB completion, to save yourselves time!
  1. first create your own local directory, with some short-cuts (links)
    unix_prompt$ mkdir My_BestPractices_CBMG688P
    unix_prompt$ cd My_BestPractices_CBMG688P
    unix_prompt$ ln -s /afs/glue.umd.edu/class/fall2012/cbmg/688p/0101/public/Lab14 Lab14Link
    unix_prompt$ ln -s Lab14Link/Perl class_Perl
  2. Set up CVS
    1. init CVS
      unix_prompt$ cvs -d ~/cvsroot init
    2. set your account so that it always knows where to find CVS
      unix_prompt$ echo $SHELL
  3. now we are ready to create a project using the class files
  4. now, lets do some stuff. first we will add a new file to the module
    unix_prompt$ cd my_cvs/Perl
    unix_prompt$ cp ../../Lab14Link/Materials/stamp_output.pl .
    unix_prompt$ cvs add stamp_output.pl
    unix_prompt$ cvs commit -m "shows how to stamp output" stamp_output.pl
  5. now we will edit the file and commit a new version.
    1. edit the file (emacs, pico, vi) so that $version = '$Id$'; (single-quotes required)
      unix_prompt$ emacs stamp_output.pl
    2. now we'll "diff", and "commit" the change. Note: we didn't use -m "<revision comments>" so CVS opens text editor
      unix_prompt$ cvs diff stamp_output.pl
      unix_prompt$ cvs commit stamp_output.pl