Colorado State University

Using RCS: an ancient Unix tool



A Brief Introduction to RCS

RCS (Revision Control System) is a method for creating, editing, and using files shared with other users. The comments below provide a quick introduction to this Unix utility.

 

To Create:

To create a new RCS file, you first need to create a file and give it a filename, say newfile.ext. Once that is done, just type
        ci newfile.ext
This will convert the file to an RCS file with an initial version number. It will also ask for you to enter a short description of the file; this description may be terminated by a line with a '.' in the first position.

When you have completed this action, check the names in the current directory. You will find that your file has disappeared, but a new file with the same name followed by the characters ',v' has appeared. For example, the new file resulting from the ci newfile.ext command would be newfile.ext,v. These *,v files are the RCS files.

RCS has the facility to allow several people to check RCS files in and out. But the person who creates the original RCS file will be the only initial permitted user. So you will need to add permission for the other users. This is done with the RCS command:
        rcs -acjcs newfile.ext
        rcs -aschauble newfile.ext
Now the persons with the login names cjcs and schauble have been added as permitted users to the RCS file called newfile,v. It is often wise to add your own login as well.

 

To Edit:

To work on a file, first you must check it out:
        co -l filename.ext
The -l puts a lock on it, meaning that no one else can modify it while you are working with it. This also allows you to check it back in when you are finished:
        ci filename.ext
The ci instruction will ask for a line explaining the changes made; you can make it blank if you wish. It can also recognize if no changes have been made. Please be sure to check it back in before you log out -- for no one else can use it till you do. Check it back in even if there were no changes! RCS has a tendency to mess up otherwise.

Do not type
        ci *
as this will attempt to check in every file in the directory -- even those which are not RCS files, such as a Makefile or a README file, unless of course, there is some reason to do so.

In other words:
  1. First checkout the file with a lock: co -l filename.ext
  2. Edit the file
  3. Store the file
  4. Check the file back in: ci filename.ext

 

To Read/Use:

If you just wish to read the file, you may check out the files without locks:
        co filename.ext
However if you make any changes to the file, the system will not let you check it back in. (See man rcsintro for an escape to this problem.)

In other words, just check out the file with no lock: co filename.ext. But do not make any changes to the file.

Note: if only the *,v version appears in the directory, you cannot edit or write to this checked out file.

 

Further Information:

Do a man on rcsintro, ci, co, etc. for more information.