1 .\" $NetBSD: co.1,v 1.5 2002/02/08 01:26:50 ross Exp $
7 .\" Id: co.1,v 5.13 1995/06/01 16:23:43 eggert Exp
15 co \- check out RCS revisions
18 .RI [ options ] " file " .\|.\|.
21 retrieves a revision from each \*r file and stores it into
22 the corresponding working file.
24 Pathnames matching an \*r suffix denote \*r files;
25 all others denote working files.
26 Names are paired as explained in
29 Revisions of an \*r file can be checked out locked or unlocked. Locking a
30 revision prevents overlapping updates. A revision checked out for reading or
31 processing (e.g., compiling) need not be locked. A revision checked out
32 for editing and later checkin must normally be locked. Checkout with locking
33 fails if the revision to be checked out is currently locked by another user.
34 (A lock can be broken with
36 Checkout with locking also requires the caller to be on the access list of
37 the \*r file, unless he is the owner of the
38 file or the superuser, or the access list is empty.
39 Checkout without locking is not subject to access list restrictions, and is
40 not affected by the presence of locks.
42 A revision is selected by options for revision or branch number,
43 checkin date/time, author, or state.
44 When the selection options
45 are applied in combination,
47 retrieves the latest revision
48 that satisfies all of them.
49 If none of the selection options
52 retrieves the latest revision
53 on the default branch (normally the trunk, see the
57 A revision or branch number can be attached
75 retrieve from a single branch, the
78 which is either specified by one of
82 or the default branch.
86 command applied to an \*r
87 file with no revisions creates a zero-length working file.
89 always performs keyword substitution (see below).
93 retrieves the latest revision whose number is less than or equal to
97 indicates a branch rather than a revision,
98 the latest revision on that branch is retrieved.
101 is omitted, the latest revision on the default branch
112 determines the revision number from keyword values in the working file.
113 Otherwise, a revision is composed of one or more numeric or symbolic fields
114 separated by periods.
117 begins with a period,
118 then the default branch (normally the trunk) is prepended to it.
121 is a branch number followed by a period,
122 then the latest revision on that branch is used.
123 The numeric equivalent of a symbolic field
124 is specified with the
126 option of the commands
134 except that it also locks the retrieved revision for
140 except that it unlocks the retrieved revision if it was
141 locked by the caller. If
145 retrieves the revision locked by the caller, if there is one; otherwise,
146 it retrieves the latest revision on the default branch.
149 forces the overwriting of the working file;
150 useful in connection with
157 Generate keyword strings using the default form, e.g.\&
158 .B "$\&Revision: \*(Rv $"
162 A locker's name is inserted in the value of the
168 only as a file is being locked,
178 except that a locker's name is always inserted
179 if the given revision is currently locked.
182 Generate only keyword names in keyword strings; omit their values.
184 .SM "KEYWORD SUBSTITUTION"
188 keyword, generate the string
191 .BR "$\&Revision: \*(Rv $" .
192 This option is useful to ignore differences due to keyword substitution
193 when comparing different revisions of a file.
194 Log messages are inserted after
199 since this tends to be more useful when merging changes.
202 Generate the old keyword string,
203 present in the working file just before it was checked in.
206 keyword, generate the string
207 .B "$\&Revision: 1.1 $"
209 .B "$\&Revision: \*(Rv $"
210 if that is how the string appeared when the file was checked in.
211 This can be useful for file formats
212 that cannot tolerate any changes to substrings
213 that happen to take the form of keyword strings.
216 Generate a binary image of the old keyword string.
219 except it performs all working file input and output in binary mode.
220 This makes little difference on POSIX and UNIX hosts,
221 but on DOS-like hosts one should use
223 to initialize an \*r file intended to be used for binary files.
226 normally refuses to merge files when
231 Generate only keyword values for keyword strings.
234 keyword, generate the string
237 .BR "$\&Revision: \*(Rv $" .
238 This can help generate files in programming languages where it is hard to
239 strip keyword delimiters like
242 However, further keyword substitution cannot be performed once the
243 keyword names are removed, so this option should be used with care.
244 Because of this danger of losing keywords,
245 this option cannot be combined with
247 and the owner write permission of the working file is turned off;
248 to edit the file later, check it out again without
252 prints the retrieved revision on the standard output rather than storing it
254 This option is useful when
259 quiet mode; diagnostics are not printed.
263 the user is prompted and questioned
264 even if the standard input is not a terminal.
267 retrieves the latest revision on the selected branch whose checkin date/time is
268 less than or equal to
270 The date and time can be given in free format.
273 stands for local time;
274 other common time zone names are understood.
275 For example, the following
278 if local time is January 11, 1990, 8pm Pacific Standard Time,
279 eight hours west of Coordinated Universal Time (\*u):
284 .ta \w'\f3Thu, 11 Jan 1990 20:00:00 \-0800\fP 'u
287 \f34:00 AM, Jan. 12, 1990\fP default is \*u
288 \f31990-01-12 04:00:00+00\fP \*i 8601 (\*u)
289 \f31990-01-11 20:00:00\-08\fP \*i 8601 (local time)
290 \f31990/01/12 04:00:00\fP traditional \*r format
291 \f3Thu Jan 11 20:00:00 1990 LT\fP output of \f3ctime\fP(3) + \f3LT\fP
292 \f3Thu Jan 11 20:00:00 PST 1990\fP output of \f3date\fP(1)
293 \f3Fri Jan 12 04:00:00 GMT 1990\fP
294 \f3Thu, 11 Jan 1990 20:00:00 \-0800\fP Internet RFC 822
295 \f312-January-1990, 04:00 WET\fP
300 Most fields in the date and time can be defaulted.
301 The default time zone is normally \*u, but this can be overridden by the
304 The other defaults are determined in the order year, month, day,
305 hour, minute, and second (most to least significant). At least one of these
306 fields must be provided. For omitted fields that are of higher significance
307 than the highest provided field, the time zone's current values are assumed.
308 For all other omitted fields,
309 the lowest possible values are assumed.
315 10:30:00 \*u of the 20th of the \*u time zone's current month and year.
316 The date/time must be quoted if it contains spaces.
320 Set the modification time on the new working file
321 to be the date of the retrieved revision.
322 Use this option with care; it can confuse
326 retrieves the latest revision on the selected branch whose state is set to
330 Preserve the modification time on the \*r file
331 even if the \*r file changes because a lock is added or removed.
332 This option can suppress extensive recompilation caused by a
334 dependency of some other copy of the working file on the \*r file.
335 Use this option with care; it can suppress recompilation even when it is needed,
336 i.e. when the change of lock
337 would mean a change to keyword strings in the other working file.
339 .BR \-w [\f2login\fP]
340 retrieves the latest revision on the selected branch which was checked in
341 by the user with login name
346 omitted, the caller's login is assumed.
349 generates a new revision which is the join of the revisions on
351 This option is largely obsoleted by
353 but is retained for backwards compatibility.
358 is a comma-separated list of pairs of the form
364 are (symbolic or numeric)
366 For the initial such pair,
368 denotes the revision selected
375 denotes the revision generated by the previous pair.
377 of one join becomes the input to the next.)
387 This means that all changes that transform
391 are applied to a copy of
393 This is particularly useful if
397 are the ends of two branches that have
399 as a common ancestor. If
400 .IR rev1 \*[Lt] rev2 \*[Lt] rev3
402 joining generates a new revision which is like
404 but with all changes that lead from
413 overlap with changes from
418 reports overlaps as described in
421 For the initial pair,
423 can be omitted. The default is the common
425 If any of the arguments indicate branches, the latest revisions
426 on those branches are assumed.
436 Print \*r's version number.
448 This can be useful when interchanging \*r files with others who are
449 running older versions of \*r.
450 To see which version of \*r your correspondents are running, have them invoke
452 this works with newer versions of \*r.
453 If it doesn't work, have them invoke
456 if none of the first few lines of output contain the string
459 if the dates' years have just two digits, it is version 4;
460 otherwise, it is version 5.
461 An \*r file generated while emulating version 3 loses its default branch.
462 An \*r revision generated while emulating version 4 or earlier has
463 a time stamp that is off by up to 13 hours.
464 A revision extracted while emulating version 4 or earlier contains
465 abbreviated dates of the form
467 and can also contain different white space and line prefixes
468 in the substitution for
474 to characterize \*r files.
480 specifies the date output format in keyword substitution,
481 and specifies the default time zone for
488 should be empty, a numeric \*u offset, or the special string
491 The default is an empty
493 which uses the traditional \*r format of \*u without any time zone indication
494 and with slashes separating the parts of the date;
495 otherwise, times are output in \*i 8601 format with time zone indication.
496 For example, if local time is January 11, 1990, 8pm Pacific Standard Time,
497 eight hours west of \*u,
498 then the time is output as follows:
503 .ta \w'\f3\-z+05:30\fP 'u +\w'\f31990-01-11 09:30:00+05:30\fP 'u
505 \f2option\fP \f2time output\fP
506 \f3\-z\fP \f31990/01/12 04:00:00\fP \f2(default)\fP
507 \f3\-zLT\fP \f31990-01-11 20:00:00\-08\fP
508 \f3\-z+05:30\fP \f31990-01-12 09:30:00+05:30\fP
515 option does not affect dates stored in \*r files,
516 which are always \*u.
518 .SH "KEYWORD SUBSTITUTION"
522 .BI $ keyword : .\|.\|. $
524 the text are replaced
525 with strings of the form
526 .BI $ keyword : value $
531 are pairs listed below.
532 Keywords can be embedded in literal strings
533 or comments to identify a revision.
535 Initially, the user enters strings of the form
539 replaces these strings with strings of the form
540 .BI $ keyword : value $ .
541 If a revision containing strings of the latter form
542 is checked back in, the value fields will be replaced during the next
544 Thus, the keyword values are automatically updated on checkout.
545 This automatic substitution can be modified by the
549 Keywords and their corresponding values:
552 The login name of the user who checked in the revision.
555 The date and time the revision was checked in.
558 a numeric time zone offset is appended; otherwise, the date is \*u.
561 A standard header containing the full pathname of the \*r file, the
562 revision number, the date and time, the author, the state,
563 and the locker (if locked).
566 a numeric time zone offset is appended to the date; otherwise, the date is \*u.
571 except that the \*r filename is without a path.
574 The login name of the user who locked the revision (empty if not locked).
577 The log message supplied during checkin, preceded by a header
578 containing the \*r filename, the revision number, the author, and the date
582 a numeric time zone offset is appended; otherwise, the date is \*u.
583 Existing log messages are
586 Instead, the new log message is inserted after
587 .BR $\&Log: .\|.\|. $ .
589 accumulating a complete change log in a source file.
592 Each inserted line is prefixed by the string that prefixes the
594 line. For example, if the
597 .RB \*(lq "//\ $\&Log: tan.cc\ $" \*(rq,
598 \*r prefixes each line of the log with
599 .RB \*(lq "//\ " \*(rq.
600 This is useful for languages with comments that go to the end of the line.
601 The convention for other languages is to use a
602 .RB \*(lq " \(** " \(rq
603 prefix inside a multiline comment.
604 For example, the initial log comment of a C program
605 conventionally is of the following form:
620 For backwards compatibility with older versions of \*r, if the log prefix is
624 surrounded by optional white space, inserted log lines contain a space
629 however, this usage is obsolescent and should not be relied on.
633 The symbolic name used to check out the revision, if any.
637 .BR "$\&Name:\ Joe\ $" .
641 .BR "$\&Name:\ \ $" .
644 The name of the \*r file without a path.
647 The revision number assigned to the revision.
650 The full pathname of the \*r file.
653 The state assigned to the revision with the
660 The following characters in keyword values are represented by escape sequences
661 to keep keyword strings well-formed.
667 \f2char escape sequence\fP
676 The working file inherits the read and execute permissions from the \*r
677 file. In addition, the owner write permission is turned on, unless
680 is checked out unlocked and locking is set to strict (see
683 If a file with the name of the working file exists already and has write
687 asking beforehand if possible.
688 If the existing working file is
691 is given, the working file is deleted without asking.
694 accesses files much as
696 does, except that it does not need to read the working file
697 unless a revision number of
703 options prepended to the argument list, separated by spaces.
708 The \*r pathname, the working pathname,
709 and the revision number retrieved are
710 written to the diagnostic output.
711 The exit status is zero if and only if all operations were successful.
713 Author: Walter F. Tichy.
715 Manual Page Revision: \*(Rv; Release Date: \*(Dt.
717 Copyright \(co 1982, 1988, 1989 Walter F. Tichy.
719 Copyright \(co 1990, 1991, 1992, 1993, 1994, 1995 Paul Eggert.
721 rcsintro(1), ci(1), ctime(3), date(1), ident(1), make(1),
722 rcs(1), rcsclean(1), rcsdiff(1), rcsmerge(1), rlog(1),
726 \*r\*-A System for Version Control,
727 .I "Software\*-Practice \*[Am] Experience"
729 7 (July 1985), 637-654.
731 Links to the \*r and working files are not preserved.
733 There is no way to selectively suppress the expansion of keywords, except
734 by writing them differently. In nroff and troff, this is done by embedding the