CVS Tutorial In order to use CVS, first determine the login shell that you are using: sh, bash, ksh, ksh93: add the following to your $HOME/.profile export CVSROOT=:ext:esp-cvs.cerias.purdue.edu:/cvs export CVS_RSH=ssh csh, tcsh: add the following to your $HOME/.login setenv CVSROOT :ext:esp-cvs.cerias.purdue.edu:/cvs setenv CVS_RSH ssh The Basics of CVS: Let's start off with a few definitions. The repository is the place where all users working on ESP will be getting and saving all their work from. One can find the repository on esp- cvs.cerias.purdue.edu in the directory /cvs. The working directory will be the place where you make changes to your version of the project. This will most likely be the home directory on your local machine. For all changes to take effect, you will need to check out the files from the repository and commit them back to the repository for all changes to take place. In line with Blake and Dan's specifications, there are 3 directories in the archive: /cvs/ESP-devel location of sensors (you will be using this directory) /cvs/ESP-os location of the updated FreeBSD and OpenBSD source trees /cvs/ESP-cvs location of the diffs The ESP-devel directory is the only directory that developers will use. The other two directories will interact with ESP-devel via the scripts that Dan and Blake are writing. The permissions for ESP-cvs and ESP-devel will be read-only and read-write for developers, respectively. I have created a testproj directory for you guys to practice your CVS skills. The first thing to do, from your home directory, is to check out a copy of the project. -bash-2.05b$ cvs checkout testproj cvs checkout: Updating testproj This command checks out the /cvs/testproj directory and creates a working directory under the name, simply enough, of testproj. Let's add a file: $$.c -bash-2.05b$ cd testproj -bash-2.05b$ touch $$.c Note: 'touch $$.c' creates a file with a pseudo random number followed by .c In this case, touch creates the file: 18891.c -bash-2.05b$ cvs add $$.c cvs add: scheduling file `18891.c' for addition cvs add: use 'cvs commit' to add this file permanently After you create $$.c, in order for changes to take effect in the respository, you need to run this command: -bash-2.05b$ cvs commit -m "created the file" $$.c RCS file: /cvs/testproj/18891.c done Checking in 18891.c; /cvs/testproj/18891.c,v <-- 18891.c initial revision: 1.1 done The -m option means the next argument will be a short description of the changes made to the file. If you don't include this option, CVS will make you add the message in vi, or whatever your EDITOR environmental variable is set to. Ok, looks good, let's add a line to $$.c: -bash-2.05b$ cat >> $$.c #comments -bash-2.05b$ cvs commit $$.c Checking in 18891.c; /cvs/testproj/18891.c,v <-- 18891.c new revision: 1.2; previous revision: 1.1 done Now, if we want to remove $$.c: -bash-2.05b$ rm $$.c -bash-2.05b$ cvs remove $$.c cvs remove: scheduling `18891.c' for removal cvs remove: use 'cvs commit' to remove this file permanently Removing 18891.c; /cvs/testproj/18891.c,v <-- 18891.c new revision: delete; previous revision: 1.1 done Now, if we want to add a directory, simply create a directory in your working directory: -bash-2.05b$ mkdir include Next, add it to the repository: -bash-2.05b$ cvs add include Directory /cvs/testproj/include added to the repository Note: with directories, the commit argument to CVS is not necessary. If another user is simultaneously making changes to the repository, you can update your working directory with the command: -bash-2.05b$ cvs update testproj Finally, when finished with the project you need to remove the working directory from your home directory. -bash-2.05b$ cd $HOME -bash-2.05b$ cvs release testproj You have [0] altered files in this repository. Are you sure you want to release directory `testproj': yes The cvs release command does the same thing as `rm -rf testproj.' However, it checks to see if you have altered any files in your working directory without first commiting them to the repository. In other words, it gives you a last chance to quit without saving. A few more topics regarding CVS: If you change multiple files, you can commit them all at once by issuing a more generic commit command: -bash-2.05b$ cvs commit -m "I was a good ESP developer and worked on multiple files today" Another useful command is: cvs log This command tells who has worked on , when they made the changes, and the corresponding release number. Now, let's say you want to retrieve an old revision of . For example, if the current revision number for were 1.4 you could issue this command to retrieve version 1.3: cvs -Q update -p -r 1.3 Here are a few useful links: http://cvsbook.red-bean.com/cvsbook.html http://www.cvshome.org/ If you have any questions, don't hesitate to email me: dulaney@cerias.purdue.edu