RCS stands for Revision Control System.
The purpose of RCS is to help you keep track of different version of
your code.
The basic facilities provided by RCS are:
To use RCS, you should make a directory named RCS (in the directory where
you will be working on your code).
RCS will store the versions of your code in that directory, but you should
never access the files in that directory yourself (only via RCS).
There are two basic RCS commands: ci (check-in), and co
(check-out).
They need to be typed in the directory that contains the RCS directory.
If the file has been checked in before, and it has not been
changed, RCS will print a message saying that the file is
unchanged, and will essentially abort the checkin (except that
if you don't use the -l flag, the file will
still be removed from your directory).
If you want to force RCS to check in the file (e.g., so that you
can provide a log message, or an attribute value -- see
Atrributes below) you must use the -f flag (to
"force" a check in).
The -l flag means lock the files being checked out.
This flag is optional; if it is omitted, the files will
be checked out, but they will be write-protected (i.e., you will
be able to read them, but you will not be able to change them).
See Group Project below for more about
locking files.
Without additional flags, you will get the most recently
checked-in version of each file.
Every file checked in to RCS has the following attributes,
which can be used, when you do a check-out, to get versions other than
the most recently checked in version:
You can also use the -r flag when you check in a
file to tell RCS to start numbering the revision with a new number.
For example: ci -r2 Test.java causes the checked-in file
to be given revision number 2.1, and subsequently checked-in versions
to be given numbers 2.2, 2.3, etc.
This might be useful in the context of your class project;
you might use revision 1 for all versions having to do with the
second assignment (the scanner), revision 2 for versions having to
do with the third assignment (the parser) etc.
It is a good idea to set the state attribute when you are checking in
multiple files that "go together". For example, suppose you are
writing a program that involves two files: Test.java and SymTab.java,
and you've gotten to a point where the program works, but is incomplete.
You might want to check in the two files with the same
state (e.g., "Working1") so that you can easily retrieve this
working version. If you don't use the state variable, and you make
some changes to each of the source files (checking in each file
individually after each change), it will be difficult to figure out
which previous versions of the two files "went together" to give you
a working program.
To see all of the log messages that have been entered for a file
when it has been checked in, use the rlog command; e.g., to
see the log messages for Test.java, type: rlog Test.java
You can also have RCS put the log messages in the file itself
by putting the text: $Log$ in the file.
This is normally done inside a comment (otherwise, for programs, it will
cause compiler errors).
For example, you could start your program as follows:
RCS can be useful if multiple people want to work on a project.
The idea is to use one directory just for RCS, and for each person
to do their actual work in their own directory.
RCS prevents simultaneous changes being made to a file as follows:
Suppose one person checks out a file using the -l flag (i.e., with
the intention of editing the file, not just looking at it), and then moves the
checked-out file to their own directory to work on it.
Now suppose another person decides to edit the same file, and so tries to
check it out using the -l flag.
RCS will complain that the file is already locked (by the first person), and
will not permit the second person to check out the file.
That's a good idea, because it prevents both people from working on the same
file at the same time.
If the second person really wants to check out the file (for writing, not
just for reading), they can break the lock by typing:
Overview
Basic Commands
The command "checks in" the named files (saves them in the RCS
directory).
The -l flag is optional; if it is omitted, the files will be
saved by RCS, and will be removed from the current directory.
When you use the check-in command, RCS will ask you for:
ci -l Test.java SymTab.java
After typing the description or log message (you can use multiple
lines), type a dot at the beginning of the line to end your input.
Attributes
Viewing the Log History
/***
* $Log$
***/
and when the file is checked out, the $Log$ will be replaced with
the actual log history (and, since the line containing $Log started
with a space and a star, all of the lines of the log history will also
start with a space and a star).
Group Projects
rcs -u <file-name>
RCS will ask for a reason for breaking the lock, and will send that reason
in an e-mail message to the person who held the lock.