CVS on Windows
Instructions
We'll be using a fictional group:
- cs152-alice
- cs152-bob
- cs152-chuck
- cs152-doris
On ONE account, the one that will be the master repository: (We'll use
cs152-alice here.)
- Make a batch file and put it
in your U: drive containing something like the following: (A batch
file is just a text file with a .bat extension that will run a series of
commands).
set PATH=M:\bin;%Path%
set CVSROOT=U:\sharedcvs\MY_SPIFFY_REPOSITORY
To use cvs properly you'll need to open a command prompt and from that
prompt run the batch file. It will setup the path properly along
with the CVSROOT variable. Then you can run cvs commands safely.
- Create a repository on your
account (this should be a directory dedicated entirely to CVS and have
nothing in it beforehand).
mkdir U:\sharedcvs
cd U:\sharedcvs
mkdir MY_SPIFFY_REPOSITORY
cd MY_SPIFFY_REPOSITORY
cvs init
- Now go find your lab
directory:
cd "U:\foo\bar\lab foo bar"
cvs import <name of lab> <vendor tag> <vendor branch>
<name of lab> is the name that you will use to check out your
lab. It can be something mundane like lab3, or something exotic like
single_cycle_adventure. <vendor tag> and <vendor branch> are
tags and branch ids that are probably meaningless to you unless you know
about the tagging and branch options in CVS (RTFM if you need to know
more). All you really need to know about them is that they are
required and that they must be alphanumeric, you'll probably never use
them again.
- If everything works properly
notepad should popup giving you a CVS logfile. Here you can put
random information about the files that you just imported. Save the
file and close it. You should see some messages about files being
imported and hopefully it will tell you that there are no conflicts.
- Now go to another directory
(to check that your import really worked):
cd u:\baz\boopcvs checkout <name of lab>
and CVS should check out the lab for you.
- Finally to give access to
your group members:
- Go to your directory
by typing it into the navbar of an explorer window. (In this example it
would be \\fileservice\cs152\sp04\cs152-alice\sharedcvs)
- Open the security tab
for that folder.
- Add cs152-bob,
cs152-chuck, and cs152-doris to the access control list.
- Give them full control
of your directory and all subfolders and files.
- BE VERY CAREFUL WHILE
DOING THIS!!! If you make a mistake and remove yourself from the
list then you will lock yourself out of your own directory! If you
didn't give any of your group members full control then they can not give
you access again and you will have to talk to Pathma (pathma@cs). I have
personally encountered bugs when updating my access control list where I
did not explicitly remove myself from the list, I only added one of the
other TAs to my ACL and it wiped all the other entries out, leaving me
with no access at all (although my fellow TAs could still read it).
If you are going to do this then I'd advise you to give full control to
at least one other person so that they can save you if something goes
wrong.
On all the OTHER accounts:(cs152-bob, cs152-chuck, cs152-doris)
- Make a batch file and put it
in your U: drive containing something like the following:
set PATH=M:\bin;%Path%
net use v: \\fileservice\cs152\sp04\cs152-alice\sharedcvs
set CVSROOT=V:\MY_SPIFFY_REPOSITORY
You'll need to run this every time you open a command prompt to do cvs
work
- Go to the directory that you
want to check out to (u:\foo\bar or c:\temp\foo\bar) and do the following:
cvs checkout <name of lab>
And you should get updated properly.
Binary Files
You'll probably want to add binary files to your cvs repository (such as a
bitfile) you can do this by using the -kb option (keyword binary) when adding
the file to the repository with cvs add. This will prevent cvs from corrupting
the file by converting EOL characters into a cannonical form or by performing
keyword replacement on the file.
How to Use Keywords
Inside of your source files you can use keyword substitution. Keyword
substitution replaces strings of the form $KEYWORD$ with strings of the form
$KEYWORD:value$. These keywords provide metadata that you can use to
identify versions of your files. You should place them in comments in
your source files.
For example: Excerpt from original source file:
// $Header$
Excerpt from keyword-replaced source file:
// $Header: U:\\MY_SPIFFY_REPOSITORY/cvstest/syntest2.v,v 1.1.1.1 2004/02/28
01:09:48 cs152-tb Exp $
The following is a list of keywords taken from the CVS manual, you can
find the original here.
The following text is Copyright © 1999-2002 CollabNet, Inc.
$Author$
The login name of the user who checked in the
revision.
$Date$
The date and time (UTC) the revision was checked
in.
$Header$
A standard header containing the full pathname of
the RCS file, the revision number, the
date (UTC), the author, the state, and the locker (if locked). Files will
normally never be locked when you use CVS.
$Id$
Same as $Header$
, except that the RCS filename is without a path.
$Name$
Tag name used to check out this file. The keyword
is expanded only if one checks out with an explicit tag name. For example, when
running the command cvs
co -r first
, the keyword expands to `Name: first'.
$Locker$
The login name of the user who locked the revision
(empty if not locked, which is the normal case unless cvs admin -l
is in use).
$Log$
The log message supplied during commit, preceded by
a header containing the RCS filename, the
revision number, the author, and the date (UTC). Existing log messages are not
replaced. Instead, the new log message is inserted after $Log:…$
. Each
new line is prefixed with the same string which precedes the $Log
keyword.
For example, if the file contains:
|
/* Here is what people have been up to: * * $Log: frob.c,v $ * Revision 1.1 1997/01/03 14:23:51 joe * Add the superfrobnicate option * */ |
then additional lines which are added when
expanding the $Log
keyword will be preceded by ` * '.
Unlike previous versions of CVS and RCS, the comment leader from the RCS file is not used. The $Log
keyword
is useful for accumulating a complete change log in a source file, but for
several reasons it can be problematic. See section Problems
with the $Log$ keyword..
$RCSfile$
The name of the RCS file without a path.
$Revision$
The revision number assigned to the revision.
$Source$
The full pathname of the RCS file.
$State$
The state assigned to the revision. States can be
assigned with cvs
admin -s