Book HomeBook TitleSearch this book

19.5. Alphabetical Summary of Commands

For details on the syntax of keywords, revision numbers, dates, states, and standard options, refer to the previous discussions.

ci

ci [options] files

Check in revisions. ci stores the contents of the specified working files into their corresponding RCS files. Normally, ci deletes the working file after storing it. If no RCS file exists, the working file is an initial revision. In this case, the RCS file is created, and you are prompted to enter a description of the file. If an RCS file exists, ci increments the revision number and prompts you to enter a message that logs the changes made. If a working file is checked in without changes, the file reverts to the previous revision.

The two mutually exclusive options -u and -l, along with -r, are the most common. Use -u to keep a read-only copy of the working file (for example, so the file can be compiled or searched). Use -l to update a revision and then immediately check it out again with a lock. This allows you to save intermediate changes but continue editing (for example, during a long editing session). Use -r to check in a file with a different release number. ci accepts the standard options -q, -V, -Vn, -T, -x, and -z.

Options

-d[date]
Check the file in with a timestamp of date or, if no date is specified, with the time of last modification.

-f[R]
Force a check-in even if there are no differences.

-i[R]
Initial check-in, report an error if the RCS file already exists.

-I[R]
Interactive mode; prompt user even when standard input is not a terminal (e.g., when ci is part of a command pipeline).

-j[R]
Just check in and do not initialize. Report an error if the RCS file does not already exist.

-k[R]
Assign a revision number, creation date, state, and author from keyword values that were placed in the working file, instead of computing the revision information from the local environment. -k is useful for software distribution: the preset keywords serve as a timestamp shared by all distribution sites.

-l[R]
Do a co -l after checking in. This leaves a locked copy of the next revision.

-mmsg
Use the msg string as the log message for all files checked in. When checking in multiple files, ci normally prompts whether to reuse the log message of the previous file. -m bypasses this prompting.

-M[R]
Set the working file's modification time to that of the retrieved version. Use of -M can confuse make and should be used with care.

-nname
Associate a text name with the new revision number.

-Nname
Same as -n, but override a previous name.

-rR
Check the file in as revision R.

-r
Without a revision number, -r restores the default behavior of releasing a lock and removing the working file. It is intended to override any default -l or -u set up by aliases or scripts. The behavior of -r in ci is different from most other RCS commands.

-sstate
Set the state of the checked-in revision.

-tfile
Replace RCS file description with contents of file. This works only for initial check-in.

-t-string
Replace RCS file description with string. This works only for initial check-in.

-u[R]
Do a co -u after checking in. This leaves a read-only copy.

-wuser
Set the author field to user in the checked-in revision.

Examples

Check in chapter files using the same log message:

ci -m'First round edits' chap*

Check in edits to prog.c, leaving a read-only copy:

ci -u prog.c

Start revision level 2; refer to revision 2.1 as “Prototype”:

ci -r2 -nPrototype prog.c
co

co [options] files

Retrieve (check out) a previously checked-in revision and place it in the corresponding working file (or print to standard output if -p is specified). If you intend to edit the working file and check it in again, specify -l to lock the file. co accepts the standard options -q, -V, -Vn, -T, -x, and -z.

Options

-ddate
Retrieve latest revision whose check-in timestamp is on or before date.

-f[R]
Force the working file to be overwritten.

-I[R]
Interactive mode; prompt user even when standard input is not a terminal.

-jR2:R3[,...]
This works like rcsmerge. R2 and R3 specify two revisions whose changes are merged into a third file: either the corresponding working file or a third revision (any R specified by other co options). Multiple comma-separated pairs may be provided; the output of the first join becomes the input of the next. See the co manpage for more details.

-kc
Expand keyword symbols according to flag c. c can be:

b

Like -ko, but uses binary I/O. This is most useful on non-Unix systems.

kv

Expand symbols to keyword and value (the default). Insert the locker's name only during a ci -l or co -l.

kvl

Like kv, but always insert the locker's name.

k

Expand symbols to keywords only (no values). This is useful for ignoring trivial differences during file comparison.

o

Expand symbols to keyword and value present in previous revision. This is useful for binary files that don't allow substring changes.

v

Expand symbols to values only (no keywords). This prevents further keyword substitution and is not recommended.

-l[R]
Same as -r, but also lock the retrieved revision.

-M[R]
Set the working file's modification time to that of the retrieved version. Use of -M can confuse make and should be used with care.

-p[R]
Send retrieved revision to standard output instead of to a working file. Useful for output redirection or filtering.

-r[R]
Retrieve the latest revision or, if R is given, retrieve the latest revision that is equal to or lower than R. If R is $, retrieve the version specified by the keywords in the working file.

-sstate
Retrieve the latest revision having the given state.

-u[R]
Same as -r, but also unlock the retrieved revision if you locked it previously.

-w[user]
Retrieve the latest revision that was checked in either by the invoking user or by the specified user.

Examples

Sort the latest stored version of file:

co -p file | sort

Check out (and lock) all uppercase filenames for editing:

co -l [A-Z]*

Note that filename expansion fails unless a working copy resides in the current directory. Therefore, this example works only if the files were previously checked in via ci -u. Finally, here are some different ways to extract the working files for a set of RCS files (in the current directory):

co -r3 *,v                    Latest revisions of release 3

co -r3 -wjim *,v              Same, but only if checked in by jim

co -d'May 5, 2 pm LT' *,v     Latest revisions that were modified on or before the date

co -rPrototype *,v            Latest revisions named Prototype
ident

ident [options] [files]

Extract keyword/value symbols from files. files can be text files, object files, or dumps. ident accepts the standard option -V.

Options

-q
Suppress warning message when no keyword patterns are found.

-V
Print the version number of ident.

Examples

If file prog.c is compiled, and it contains this line of code:

char rcsID[] = "$Author: ellie $";

the following output is produced:

$ ident prog.c prog.o
prog.c:
     $Author: ellie $
prog.o:
     $Author: ellie $

Show keywords for all RCS files (suppress warnings):

co -p RCS/*,v | ident -q
merge

merge [options] [diff3 options] file1 file2 file3

Perform a three-way merge of files (via diff3) and place changes in file1. file2 is the original file. file1 is the “good” modification of file2. file3 is another, conflicting modification of file2. merge finds the differences between file2 and file3, and then incorporates those changes into file1. If both file1 and file3 have changes to common lines, merge warns about overlapping lines and inserts both choices in file1. The insertion appears as follows:

<<<<<<< file1
lines from file1</>
========
lines from file3
>>>>>>> file3

You'll need to edit file1 by deleting one of the choices. merge exits with a status of 0 (no overlaps), 1 (some overlaps), or 2 (unknown problem). See also rcsmerge.

merge accepts the -A, -e, and -E options for diff3, and simply passes them on, causing diff3 to perform the corresponding kind of merge. See the entry for diff3 in Chapter 2, for details. (The -A option is for the GNU version of diff3.)

Options

-L label
This option may be provided up to three times, providing different labels in place of the filenames file1, file2, and file3, respectively.

-p
Send merged version to standard output instead of to file1.

-q
Produce overlap insertions but don't warn about them.

rcs

rcs [options] files

An administrative command for setting up or changing the default attributes of RCS files. rcs requires you to supply at least one option. (This is for “future expansion.”)

Among other things, rcs lets you set strict locking (-L), delete revisions (-o), and override locks set by co (-l and -u). RCS files have an access list (created via -a); anyone whose username is on the list can run rcs. The access list is often empty, meaning that rcs is available to everyone. In addition, you can always invoke rcs if you own the file, if you're a privileged user, or if you run rcs with -i. rcs accepts the standard options -q, -V, -Vn, -T, -x, and -z.

Options

-ausers
Append the comma-separated list of users to the access list.

-Aotherfile
Append otherfile's access list to the access list of files.

-b[R]
Set the default branch to R or, if R is omitted, to the highest branch on the trunk.

-c's'
The comment leader for $Log: ch19_05.htm,v $
-c's'
The comment leader for Revision 1.2 2002/11/08 17:52:40 ellie
-c's'
The comment leader for fixed entities
-c's'
The comment leader for
-c's'
The comment leader for Revision 1.1 2002/11/04 21:32:22 ellie
-c's'
The comment leader for Initial revision
-c's'
The comment leader for keywords is set to string s. You could, for example, set s to .\" for troff files or set s to * for C programs. (You would need to manually insert an enclosing /* and */ before and after $Log: ch19_05.htm,v $ enclosing /* and */ before and after Revision 1.2 2002/11/08 17:52:40 ellie enclosing /* and */ before and after fixed entities enclosing /* and */ before and after enclosing /* and */ before and after Revision 1.1 2002/11/04 21:32:22 ellie enclosing /* and */ before and after Initial revision enclosing /* and */ before and after .)

-c is obsolescent; RCS uses the character(s) preceding $Log: ch19_05.htm,v $ Revision 1.2 2002/11/08 17:52:40 ellie fixed entities Revision 1.1 2002/11/04 21:32:22 ellie Initial revision in the file as the comment leader for log messages. You may wish to set this, though, if you are accessing the RCS file with older versions of RCS.

-e[users]
Erase everyone (or only the specified users) from the access list.

-i
Create (initialize) an RCS file, but don't deposit a revision.

-I
Interactive mode; prompt user even when standard input is not a terminal.

-kc
Use c as the default style for keyword substitution. (See co for values of c.) -kkv restores the default substitution style.

-l[R]
Lock revision R or the latest revision. -l “retroactively locks” a file and is useful if you checked out a file incorrectly by typing co instead of co -l. rcs will ask you if it should break the lock if someone else has the file locked.

-L
Turn on strict locking (the default). This means that everyone, including the owner of the RCS file, must use co -l to edit files. Strict locking is recommended when files are to be shared. (See -U.)

-mR:msg
Use the msg string to replace the log message of revision R.

-M
Do not send mail when breaking a lock. This is intended for use by RCS frontends, not for direct use by users!

-nflags
Add or delete an association between a revision and a name. flags can be:

name:R

Associate name with revision R.

name:

Associate name with latest revision.

name

Remove association of name.

-Nflags
Same as -n, but overwrite existing names.

-oR_list
Delete (outdate) revisions listed in R_list. R_list can be specified as: R1, R1:R2, R1:, or :R2. When a branch is given, -o deletes only the latest revision on it. The - range separator character from RCS versions prior to 5.6 is still valid.

-sstate[:R]
Set the state of revision R (or the latest revision) to the word state.

-t[file]
Replace RCS file description with contents of file or, if no file is given, with standard input.

-t-string
Replace RCS file description with string.

-u[R]
The complement of -l: unlock a revision that was previously checked out via co -l. If someone else did the check-out, you are prompted to state the reason for breaking the lock. This message is mailed to the original locker.

-U
Turn on nonstrict locking. Everyone except the file owner must use co -l to edit files. (See -L.)

Examples

Associate the label To_customer with the latest revision of all RCS files:

rcs -nTo_customer: RCS/*

Add three users to the access list of file beatle_deals:

rcs -ageorge,paul,ringo beatle_deals

Delete revisions 1.2 through 1.5:

rcs -o1.2:1.5 doc

Replace an RCS file description with the contents of a variable:

echo "$description" | rcs -t file
rcsclean

rcsclean [options] [files]

Although included with RCS, this command is optional and might not be installed on your system. rcsclean compares checked-out files against the corresponding latest revision or revision R (as given by the options). If no differences are found, the working file is removed. (Use rcsdiff to find differences.) rcsclean is useful in makefiles; for example, you could specify a “clean-up” target to update your directories. rcsclean is also useful prior to running rcsfreeze. rcsclean accepts the standard options -q, -V, -Vn, -T, -x, and -z.

Options

-kc
When comparing revisions, expand keywords using style c. (See co for values of c.)

-n[R]
Show what would happen but don't actually execute.

-r[R]
Compare against revision R. R can be supplied as arguments to other options, so -r is redundant.

-u[R]
Unlock the revision if it's the same as the working file.

Example

Remove unchanged copies of program and header files:

rcsclean *.c *.h
rcsdiff

rcsdiff [options] [diff_options] files

Compare revisions via diff. Specify revisions using -r as follows:

# of RevisionsComparison Made
NoneWorking file against latest revision.
OneWorking file against specified revision.
TwoOne revision against the other.

rcsdiff accepts the standard options -q, -V, -Vn, -T, -x, and -z, as well as diff_options, which can be any valid diff option. rcsdiff exits with a status of 0 (no differences), 1 (some differences), or 2 (unknown problem). The -c option to diff can be very useful with rcsdiff.

rcsdiff prints “retrieving revision ...” messages to standard error, as well as a line of equals signs for separating multiple files. It is often useful to redirect standard error and standard output to the same file.

Options

-kc
When comparing revisions, expand keywords using style c. (See co for values of c.)

-rR1
Use revision R1 in the comparison.

-rR2
Use revision R2 in the comparison. (-rR1 must also be specified.)

Examples

Compare the current working file against the last checked-in version:

rcsdiff -c ch19.sgm 2>&1 | more

Compare the current working file against the very first version:

rcsdiff -c -r1.1 ch19.sgm 2>&1 | more

Compare two earlier versions of a file against each other:

rcsdiff -c -r1.3 -r1.4 ch19.sgm 2>&1 | more
rcsfreeze

rcsfreeze [name]

Although included with RCS, this shell script is optional and might not be installed on your system. rcsfreeze assigns a name to an entire set of RCS files, which must already be checked in. This is useful for marking a group of files as a single configuration. The default name is C_n, where n is incremented each time you run rcsfreeze.

rcsmerge

rcsmerge [options] [diff3 options] file

Perform a three-way merge of file revisions, taking two differing versions and incorporating the changes into the working file. You must provide either one or two revisions to merge (typically with -r). Overlaps are handled the same as with merge, by placing warnings in the resulting file. rcsmerge accepts the standard options -q, -V, -Vn, -T, -x, and -z. rcsmerge exits with a status of 0 (no overlaps), 1 (some overlaps), or 2 (unknown problem).

rcsmerge accepts the -A, -e, and -E options for diff3 and simply passes them on, causing diff3 to perform the corresponding kind of merge. See merge, and also see the entry for diff3 in Chapter 2 for details. (The -A option is for the GNU version of diff3.)

Options

-kc
When comparing revisions, expand keywords using style c. (See co for values of c.)

-p[R]
Send merged version to standard output instead of overwriting file.

-r[R]
Merge revision R or, if no R is given, merge the latest revision.

Examples

Suppose you need to add updates to an old revision (1.3) of prog.c, but the current file is already at revision 1.6. To incorporate the changes:

co -l prog.c          Get latest revision
(Edit latest revision by adding updates for revision 1.3, then:)

rcsmerge -p -r1.3 -r1.6 prog.c > prog.updated.c

Undo changes between revisions 3.5 and 3.2, and overwrite the working file:

rcsmerge -r3.5 -r3.2 chap08
rlog

rlog [options] files

Display identification information for RCS files, including the log message associated with each revision, the number of lines added or removed, date of last check-in, etc. With no options, rlog displays all information. Use options to display specific items. rlog accepts the standard options -q, -V, -Vn, -T, -x, and -z.

Options

-b
Prune the display; print only about the default branch.

-ddates
Display information for revisions whose check-in timestamp falls in the range of dates (a list separated by semicolons). Be sure to use quotes. Each date can be specified as:

d1 < d2
Select revisions between date d1 and d2, inclusive.

d1 <
Select revisions made on or after date1.

d1 >
Select revisions made on or before date1.

Timestamp comparisons are strict. If two files have exactly the same time, < and > won't work. Use <= and >= instead.

-h
Display the beginning of the normal rlog listing.

-l[users]
Display information only about locked revisions or, if users is specified, only about revisions locked by the list of users.

-L
Skip files that aren't locked.

-N
Don't print symbolic names.

-r[list]
Display information for revisions in the comma-separated list of revision numbers. If no list is given, the latest revision is used. Items can be specified as:

The range separator character from RCS versions prior to 5.6 is still valid.

R1

Select revision R1. If R1 is a branch, select all revisions on it.

R1.

If R1 is a branch, select its latest revision.

R1:R2

Select revisions R1 through R2.

:R1

Select revisions from beginning of branch through R1.

R1:

Select revisions from R1 through end of branch.

-R
Display only the name of the RCS file.

-sstates
Display information for revisions whose state matches one from the comma-separated list of states.

-t
Same as -h, but also display the file's description.

-w[users]
Display information for revisions checked in by anyone in the comma-separated list of users. If no users are supplied, assume the name of the invoking user.

Examples

Display the revision histories of all your RCS files:

rlog RCS/*,v | more

Display names of RCS files that are locked by user daniel.

rlog -R -L -ldaniel RCS/*

Display the “title” portion (no revision history) of a working file:

rlog -t calc.c



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.