LabCVS

How to use the lab CVS respository (CVS is a "track changes" system)

Someone should explain this!

Maybe some links to web sites explaining CVS, and some example commands for adding things to the repository

You need to set some environment variables in your .cshrc or .login (or .bashrc or .profile) file. Luckily, if you included stuartlab-init.csh (which you already should have... see the "new to the lab" section if you haven't), then this variable gets set for you.

$CVSROOT = /projects/compbio/cvsroot/stuartlab

To make sure it's set, type echo $CVSROOT. If you don't see that line above, then you should source your init file (source ~/.cshrc -- it reloads the init file), or you can just log back out and log in again.

How to revert to previous changes

We will call the file you want to revert here is MYFILE.

First, COPY the current file, in case something gets messed up. cp MYFILE copy_of_MYFILE

Now figure out how long ago you want to get changes from. Here we will pick 3 days. cvs diff -D "3 days ago" MYFILE

This tells us the DIFFERENCES between the 3-days-ago copy and the copy in your current directory.

Now let's recover the old copy and overwrite the current one. cvs diff -D "3 days ago" MYFILE | patch -R

Now the copy of MYFILE that we have is the one from 3 days ago, instead of the one we had just a minute ago.

How to UNDELETE a file in the CVSROOT Attic

Note that this only applies if you did a cvs remove somefile on a file accidentally. Try not to do this! It doesn't matter if you regular-style removed (rm) a file from your directory (in such a case, cvs update should restore it).

If you somehow deleted a file anyway, and you don't know what's up, you should email stuartlab and make someone who understands the repository fix things. THERE IS NO FIXING THE CVS REPOSITORY if it gets messed up! You can fix your local checked-out copy, but when you're changing the master repository, you have to pray that we have a backup (and we probably don't).


Reviving files. This is more or less directly copied from: http://www.blender.org/documentation/intranet/conventions/cvs.html

DO NOT RUN ANY COMMANDS HERE UNLESS YOU ARE POSITIVE YOU KNOW WHAT YOU'RE DOING. BACK UP THE ATTIC DIRECTORY FIRST!

This should be implemented some day as 'cvs undelete'. There are two solutions, one that deals with cvs surgery and one that does not which we show first :

cvs status initrender_ext.h gives Repository revision: 1.2, subtract by one for the next action: cvs update -p -r 1.1 initrender_ext.h > initrender_ext.h cvs add initrender_ext.h cvs commit initrender_ext.h

And the cvs-surgery one (Alex's note: this is the one I used): First copy the file from Attic into your home directory, in case you mess up the file with rcs.

To revive a file which was removed by a 'cvs delete', copy the file from the 'original-directory'/Attic directory in the CVS repository to the directory above. Then use 'rlog file,v' to get the latest revision number (let's say it is X.Y), the 'state:' for that revision will be 'dead'. Revive the file using the following command:

rcs -sExp:X.Y file,v After this a 'cvs update' in your own working directory should make the file reappear.

I tried this and it actually worked. --Alex