UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: Reference: ciChapter 19
The Revision Control System
Next: Reference: ident
 

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


Previous: Reference: ciUNIX in a Nutshell: System V EditionNext: Reference: ident
Reference: ciBook IndexReference: ident

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System