Berkeley Lab CIS
A-Z Index
Search
Phone Book
Help Desk
Ernest Orlando Lawrence Berkeley National Laboratory

How do I use RCS (Revision Control System)

rcs usage notes (Berkeley Lab UNIX machines)

Getting Started with RCS (from rcsintro)

Note well: You need to use module load rcs to use rcs.
The man pages on commands like ci, co, etc., are of course useful.
Here is a brief, practical introduction based in part on the rcsintro man page.

Suppose you have a file myfile.html that you wish to put under control of RCS. If you have not already done so, make an RCS subdirectory of the current directory with the command

mkdir RCS

Then invoke the check-in command:
ci -u myfile.html
This command creates an RCS file in the RCS directory, stores myfile.html into it as revision 1.1, and leaves the current copy of myfile.html in the current directory. It also asks you for a description. The description should be a synopsis of the contents of the file. All later check-in commands will ask you for a log entry, which should summarize the changes that you made.

Files in the RCS directory are called RCS files; the others are called working files.

Updating files under RCS

To edit myfile.html, which you have already stored under RCS, you must lock it as you check it out by
co -l myfile.html
You can now edit myfile.html.

rcsdiff myfile.html
tells you the difference between the most recently checked in version and the working file.

Check the file back in by invoking
ci -u myfile.html
This increments the revision number properly; you need to supply a log entry, which should summarize the changes that you made. Again, put a new file under RCS control by
ci -u newfile.html

Retrieving and reverting to an earlier version of the file

This section was corrected and updated Mon Oct 1 18:07:02 PDT 2001

Retrieve and then revert to an older version (for example 1.3) of a file by

  1. Retrieve version 1.3 of the file by
    co -l -r1.3 myfile.html


  2. cp -p myfile.html myfile.html.1.3


  3. Put it back by

    ci -u myfile.html
  4. Now, get the current version of the file by co -l myfile.html


  5. REPLACE that version with version 1.3 by
    mv myfile.html.1.3 myfile.html
    ci -u myfile.html
    with appropriate comment

Overwriting a mistake

If you
co -l file.html
and edit it and realize you have made irremediable errors, just do
co -l file.html
to get back the version with which you started. Then edit it as needed or check it back it without any changes.

Correcting an RCS comment

Use 'rcs -mREV:msg FILENAME' to correct RCS comment REV in FILENAME.
For example
rcs -m1.448:'mg ; make jgipgf1 go to rhodeisland.jgi-psf.org' printcap.dp

History

rlog file.html
shows the history of file.html

Locking: showing locked files, conflicts

Given that your RCS files are in the directory RCS,

  • rlog -L -R RCS/*
    shows all RCS locked files. This alias may therefore useful:
    alias rcslocks 'rlog -L -R RCS/*'

  • rlog -L -R -lusername RCS/*
    prints the name of RCS files locked by the user username.

  • rlog -L -h RCS/*
    This prints the headers of the RCS-locked files.

  • rlog -L -l RCS/*
    This prints the headers plus the log messages of the locked revisions.

  • rlog RCS/*
    This command prints complete information on RCS activity.

If myfile.html complains with the message "ci error: no lock set by your name", do
rcs -l myfile.html
This command will lock the latest revision for you, unless somebody else got ahead of you -- then you'll have to negotiate with that person.


© Copyright 2000 Lawrence Berkeley National Laboratory
Page Owner: CIS

Comments