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


Other RCS commands

Ci and co are the most commonly used commands. There are some auxillary commands that are quite useful. You can change the actual RCS file with rcs, compare to revisions of a file with rcsdiff, examine the history of the file with rlog, combine two divergent revisions with rcsmerge, and find identifying RCS keywords in binary or text files.

Changing attributes

Each RCS file has certain characteristics that RCS uses. Some of these can be changed during check in time and some it is not conveniant to do so at check in time. The command rcs can be considered a utility to operate on RCS files.

Locking and unlocking

The most important attribute is whether a file is locked or unlocked. This attribute can be changed by saying rcs -l filenames to lock `filenames' or rcs -u filenames to unlock the files. This only changes the RCS file (`RCS/test.c,v' for example) and not the actual file (`test.c'). You cannot unlock or lock a file that somebody else already has a lock on. Undisciplined use of this command can wreak havoc.

Access list

The access list is used to determine who is allowed to lock an RCS file. This feature can be used to limit who has the priviledge to modify a file. By default it is empty which implies everybody can check the file out locked. There are three commands to change the access list:

-a
Append the following list of login names to the access list.
rcs -apete,jim,alex test1.c test2.c test3.c
causes pete, jim, and alex to be added to the list of people allowed to check the files `test1.c, test2.c', and `test3.c' with a lock. If the list was empty, then those three people are the only ones that can check it out locked. Note there are no spaces between the names and the -a flag.
-A
The argument indicates a RCS filename to find the access list.
rcs -Atest1.c test2.c test3.c
adds the access list for file `test1.c' to files `test2.c' and `test3.c'.
-e
Use the to erase the login names from the access list. This is the converse of the -a option.

Symbolic names

If you did not assign a symbolic name at check in time, it can be done later with rcs. You can add a name to the current revision, add a name to a specified revision, or delete a name.

-nname:rev
Assigns name to revision rev. The : acts as a seperator between the name and the revision number. It is an error for name to already be assigned a revision, use the -N option to change a revision a name refers to.
rcs -nVersion_1:1.13 test.c
If you do not specify a revision, then name is deleted.
rcs -nVersion_1 test.c
deletes the symbolic name Version_1.
-Nname:rev
Identical to -n except if the symbolic name name exists, it is reassigned to the specified revision rev.
-Sname
Useful if you want to do large scale assignment of a symbolic name to the current revision (on the trunk). Works like -n, including not allowing overriding a previous assignment of name.

Comment string

The comment string (or comment leader) is printed before every line add from the expansion of the $Log$ keyword. When an RCS file is initialy checked in, RCS guesses at what this string should be based on the suffix of the file name. For example, it is set to " * " for files ending in `.c' and to "c " for files ending in `.f'. It can be changed to any string.

rcs -c"### " test.c

Note the use of quotes to get the space as part of the comment string.

Strict locking

Strict locking is the default. It means the owner of a file cannot check a file in without having first locked the file. Struct locking is set with the -L flag. Non-strict locking means the owner of the file can just check the file in. It is set with the -U flag. There is no reason to use this. Keep locking as strict (-L) which is the default.

State

You can change the state of any revision of the file.

rcs -sReleased RCS/*,v

sets the state to Released for the current revision of each file in the RCS directory. To set the state for a specific revision:

rcs -sReleased:1.10 test.c

or

rcs -r1.10 -sReleased test.c

are equivalent.

Descriptive text

The descriptive text has limited usefulness. When you first check a file into RCS, you are prompted for the descriptive text. To change that text, use the -t option to rcs. The following example enters one line of descriptive text:

demo% rcs -t test.c
RCS file: RCS/test.c,v
enter description, terminated with ^D or '.':
NOTE: This is NOT the log message!
>> A simple test file.
>> .
done

You can also specify a file to be used as the descriptive text. This is useful if you want the descriptive text to be the same for a group of files

rcs -t/tmp/message *.c *.h Makefile

uses the text in `/tmp/message' as the descriptive text for all the C, include, and make files.

Deleting revisions

Occasionally, you may decide that an RCS file is taking up too much disk space and it is time to clean things up or you could just be embarrased by a particular revision and want to get rid of it. You can delete a range of revisions. Symbolic names can be used to specify the range. (The -o stands for "outdates").

rcs -o1.4 test.c

deletes revision 1.4.

rcs -o1.4-1.10 test.c

deletes everything between revisions 1.4 and 1.10. The following is a little more daring (and foolish):

rcs -oVersion_1-Version_2 test.c

deletes all the intermediate files between Version_1 and Version_2 (the daring part). However it also deletes Version_1 and Version_2 (the foolish part) since the range is inclusive.

rcs -o-1.4 test.c

deletes everything up to and includeing revision 1.4 (this is probably equivalent to 1.1-1.4).

rcs -o1.4- test.c

deletes everything after revision 1.4, inclusive.

None of the outdated revisions may have branches or locks.

Printing differences

You can find out all the changes from one revision to the next or between any pair of revisions with the rcsdiff command. rcsdiff accepts the same options as diff.

You can diff the current, working version (the file that is in your directory) with any previous revision of the file. If you do not explicitly indicate which revision, rcsdiff uses the latest revision on the trunk.

rcsdiff test.c

compares the working version of `test.c' with the file you would get if you said co test.c.

If you specify only one revision, then rcsdiff retrieves that revision and compares it with the working version.

rcsdiff -rVersion_1 test.c

Uses the symbolic name Version_1 to compare against.

If you specify two revisions, then those two revisions of the file are compared and the working file is ignored.

rcsdiff -rVersion_1 -rVersion_2 test.c

finds the differences between the two versions, ignoring what `test.c' might look like.

Multiple file names may be given, in which case the comparison is performed for each file.

rcsdiff -rVersion_1 -rVersion_2 RCS/*,v

prints the changes between the two versions for each file.

Log messages

To find out the state of an RCS file or to look at the revision history of the file, use the rlog command. If no options are specified you get a header that tells you the current state of the file followed by log message for each revision.

demo% rlog test.c

RCS file:        RCS/test.c,v;   Working file:    test.c
head:            1.3
locks:           ;  strict
access list:   
symbolic names:  V3: 1.3;  V1: 1.1;
comment leader:  " * "
total revisions: 3;    selected revisions: 3
description:
A simple test file.
----------------------------
revision 1.3        
date: 87/04/07 11:50:58;  author: pete;  state: Exp;
lines added/del: 6/3
fjsadl.
----------------------------
revision 1.2        
date: 87/04/02 14:14:52;  author: pete;  state: Exp;
lines added/del: 11/8
Misspelt Revision keyword.
----------------------------
revision 1.1        
date: 87/04/02 14:13:27;  author: pete;  state: Exp;  
Initial revision
=======================================================
demo%

Merging versions

rcsmerge

Identifying files

ident


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