Go to the first, previous, next, last section, table of contents.


A guide to using RCS Pete Ware

What RCS does

RCS stands for Revision Control System and is made of seven programs: ci, co, rcs, rcsmerge, rcsdiff, ident, and rlog. In addition, make knows about RCS and is able to interact with RCS. Files under RCS management are distuingished by having a `,v' appended to the name of the file. These files should be considered private to RCS, even though they are normal ascii files. It is common for each working directory to have a directory called `RCS' with all the files private to RCS kept there. This helps minimize on the number of files in your working directory.

Using RCS means a change in behaviour, which is annoying to some, but unavoidable. You must learn two things: to check out a file before changing it and to check the file back in after changes are made.

Keeps track of changes

This is the primary purpose of RCS. Each time you change a file and check the file back into RCS, RCS calculates the minimum number of lines that have changed between the earlier revision and the revision you just checked in. It saves these differences so that you can recover an earlier version. Since only the differences between the two revisions are saved, there is not much wasted space.

You can compare any two revisions of the file. This is especially useful if you have just made some changes that introduced a bug and are curious to see what is different between the current version and previous one. You can recover any revision of a file, from the original source up to the current version.

You are even protected against stupid mistakes like `rm *.c', since you can recover these files up to the time of the last revision. To take advantage of this you must make small, incremental changes and check each file back into RCS when you are done.

Allows sharing of source files

As more people work on a project, it becomes more likely that two people are going to make changes to the same file at the same time -- one of you is going to lose. RCS avoids this problem by requiring that you first lock a file prior to editing it; only one person can have a lock at a time. The above is called access control.

Since RCS can keep its files in a subdirectory called `RCS' of your working directory, it is easy to allow multiple references to the source code. This is done by creating a soft link with the command `ln -s' to the `RCS' directory itself. RCS then thinks this is a normal `RCS' directory and allows you access to the files contained in it (subject to the above mentioned access control). This ability is very practical when it comes to preparing a version of the software for testing without disturbing other developers efforts.

Maintains Log

Everytime you check a file into RCS, you are prompted for a log message. This is an excellent chance to enter a one or two line message describing the changes in this revision. It is unfortunate, but you can enter empty log messages -- however, if you can't take the 30 seconds to describe what you've done, why did you do it?

RCS also notes the author of the changes and the date and time. This information can be stored and updated automatically in the text of your file.

RCS and make

make knows about RCS and how to get files from it. If a source file is missing, make looks for the corresponding RCS file and performs a check out. make also checks if the RCS file is more recent then the current file and attempts to check it out if it is. Everytime make checks a file out, it sets the time stamp on the file to be the same as the RCS file. This causes the dependencies between RCS files, source files and object files (`.o''s) to maintain the correct relationship. Also, an object (`.o') file will not be recompiled if the RCS version has not changed, even if make had to check it out from RCS to find the file. When make is finished, it removes any files it had to check out from RCS.

In other words, make may seem to be checking out a lot of files from RCS, but they are not being recompiled.

This is not available with all versions of make, nor on all computers! For instance, GNU make, version 3.62, has this capability. Others may or may not, and it is best to check the documentation for the version of make that you have.

Other Code Maintenance Facilities

Other programs useful for code maintenance are:

SCCS
Unfortunately, SCCS is not free. Furthermore, SCCS does not provide for symbolic names.
CVS
CVS is a front-end for RCS that allows parallel development: Many people can work on the same source at once, and it provides for parallel development in an orderly way. It also allows you to manage an entire directory tree at once rather than each level of the directory tree seperately. CVS is available as prep.ai.mit.edu:/pub/gnu/cvs-version.tar.Z, and is under the GNU copyleft. version as of this writing is 1.3.


Go to the first, previous, next, last section, table of contents.