How to set up a personal CVS repository
setenv CVS_RSH ssh
/student/abc123/mycvs (where abc123 is
replaced with your own NSID, of course).
cvs -d somemachine:/student/abc123/mycvs/root init
where somemachine is replaced with the name of any
computer that you can login to and where /student/abc123
is available (e.g. any of the stealth machines.
cribbage which happens to live
in a directory called cribbage, and which consists of the
following files:
total 47
-rw-r--r-- 1 abc123 student 104 Dec 12 08:56 Makefile
-rw-r--r-- 1 abc123 student 608 Dec 12 08:56 README
-rw-r--r-- 1 abc123 student 45352 Dec 12 08:56 cribbage.c
The correct way to import this project is to do the following two commands:
cd ..../cribbage
cvs -d somemachine:/student/abc123/mycvs/root import -m "Initial import of my cribbage project" cribbage vtag rtag
This will create a module called cribbage.
It is not necessary to have all (or any!) project files present when a
module is created. It is sufficient to only have the main project
directory. For example:
mkdir myproject
cd myproject
cvs -d somemachine:/student/abc123/mycvs/root import -m "Initial import of myproject" myproject vtag rtag
is all that is needed to make an empty project named myproject.
cvs -d stealth10:/student/abc123/mycvs/root checkout cribbage
TODO to the cribbage repository:
cd cribbage
cp /student/abc123/TODO .
cvs add TODO
cvs commit -m "Initial commit" TODO
If you have a line that contains the string:
$Id$
anywhere in your file, then that string will get expanded to something like:
$Id: TODO,v 1.1 2006/11/29 11:16:58 abc123 Exp $
after the initial import. Each time you check-in or check-out a
revision, the version of the file will be displayed in this line.
When doing the cvs commit, the -m "Initial
commit" is the message to associate with the commit. If you
don't specify this, then your favorite editor will be fired up, and
you'll be asked to provide a comment on the changes being checked in.
cd /tmp
cvs -d stealth10:/student/abc123/mycvs/root co cribbage
Note that this pulls out the entire contents of the module 'cribbage'.
If we just wanted the one file, we could do:
cvs -d stealth10:/student/abc123/mycvs/root co cribbage/TODO
Once you are working inside the module directory (where CVS
directories exist) there is no need to specify the repository being
used.
cd cribbage
vi TODO
# make some changes
cvs ci TODO # (or 'cvs commit TODO')
observe that the $Id$ line is now something like:
$Id: TODO,v 1.2 2006/11/29 11:23:19 abc123 Exp $
cvs -d stealth10:/student/abc123/mycvs/root -q update -dPA
The '-q' says to do this job quietly, and the
'-dPA' is needed to make
sure that new directories and removed files/directories get dealt with
correctly.
cvs history scan.pl # see who's changed the file recently.
cvs annotate scan.pl # see who modified what lines, and when.
# Also known as 'cvs blame' in some circles :)
# show a regular 'diff' between revisions 1.1 and 1.2
cvs diff -r 1.1 -r 1.2 scan.pl
# show a context 'diff' between revisions 1.1 and 1.2
cvs diff -c -r 1.1 -r 1.2 scan.pl
man cvs' for more information, and/or consult
your favorite web-resource for more information on cvs.
mkdir /student/abc123/hidden
chmod 711 /student/abc123/hidden
mkdir /student/abc123/hidden/abcd1234
chgrp student /student/abc123/hidden/abcd1234
chmod 770 /student/abc123/hidden/abcd1234
chmod g+s /student/abc123/hidden/abcd1234
Note that these directories will be created with your default group
and that you will want to chgrp them to a group that all
users share (e.g. student). As well, the only
``security'' here is that only users who know the full path to the
repository will be able to read or modify the files. The repository
path will then be somemachine:/student/abc123/hidden/abcd1234.
In the second case, you will be assigned a group name similar to
stgr0001. The setup for the directories can be simply:
mkdir /student/abc123/mycvs
chgrp stgr0001 /student/abc123/mycvs
chmod 770 /student/abc123/mycvs
chmod g+s /student/abc123/mycvs
and the repository path will be just
somemachine:/student/abc123/mycvs.
cvs init command. stgr0001
are to have access to the repository, then perform the following:
chgrp -R stgr0001 /student/abc123/mycvs/root
find /student/abc123/mycvs/root -type d -exec chmod g+s {} \;
This will allow anyone in group stgr0001 to access and
change files in the repository.
cribbage, it will likely be necessary to make sure that
the permissions on the new module are set properly. For group
stgr0001 the following lines would take care of this:
chgrp -R stgr0001 /student/abc123/mycvs/root/cribbage
chmod g+s /student/abc123/mycvs/root/cribbage