Software Methods and Tools

Kenneth M. Anderson <kena@cs.colorado.edu>

Lecture 12: Versioning and RCS

Today's Lecture

Version Control (1 of 3)

Version Control (2 of 3)

world1.c world2.c
int main() {
    printf("hello world")
}
int main() {
    printf("HELLO WORLD!")
}
$ diff world1.c world2.c
2c2
<  printf("hello world");
---
>  printf("HELLO WORLD!");

$ diff world2.c world1.c
2c2
<  printf("HELLO WORLD!");
---
>  printf("hello world");

Version Control (3 of 3)

Tracking Changes

Tracking Changes

Version Graphs

Version Control Files

Version Control Systems

RCS: Revision Control System

RCS Locks

RCS Version Control File

RCS Example

Start with a file

rw------- CommentBook

Create a version control file

$ ci CommentBook
initial revision: 1.1
r-------- CommentBook,v

Version Control File created; note: not writeable by user

To retrieve the original file

$ co CommentBook
r-------- CommentBook
r-------- CommentBook,v

Note: the version control file is created
in the same directory as the original file
UNLESS there is a directory called RCS.

If an RCS directory exists, the version control
file is created in the RCS directory

You can always retrieve a working file from the version control file

r-------- CommentBook
r-------- CommentBook,v

$ rm CommentBook
r-------- CommentBook,v

$ co CommentBook
r-------- CommentBook
r-------- CommentBook,v

The checked-out file is called
“the working file”

Use the -l flag to create a lock on the working file

$ co -l CommentBook
rw------- CommentBook
r-------- CommentBook,v

A normal co command produces a read-only
working file; to get a writeable version, you
must lock the working file

$ ci CommentBook
new revision: 1.2
r-------- CommentBook,v

After you have made changes, you can check
them in to make a new version

RCS Keywords

RCS Version Numbering

RCS Version Numbers

Other RCS Tools

Tool Description
rcs an admin tool; can perform tasks such as breaking locks, changing log messages, erasing versions, etc. See man page for details.
rlog display log messages for a particular file (each time you check in a file, you are asked to enter a log message describing the changes)
rcsdiff a diff command for rcs versions. For example, rcsdiff -r1.1 -r1.2 CommentBook will show the differences between the specified versions without checking those versions out

Coming Up Next