]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - gnu/usr.bin/rcs/co/co.1
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / gnu / usr.bin / rcs / co / co.1
1 .de Id
2 .ds Rv \\$3
3 .ds Dt \\$4
4 ..
5 .Id $FreeBSD$
6 .ds i \&\s-1ISO\s0
7 .ds r \&\s-1RCS\s0
8 .ds u \&\s-1UTC\s0
9 .if n .ds - \%--
10 .if t .ds - \(em
11 .TH CO 1 \*(Dt GNU
12 .SH NAME
13 co \- check out RCS revisions
14 .SH SYNOPSIS
15 .B co
16 .RI [ options ] " file " .\|.\|.
17 .SH DESCRIPTION
18 .B co
19 retrieves a revision from each \*r file and stores it into
20 the corresponding working file.
21 .PP
22 Pathnames matching an \*r suffix denote \*r files;
23 all others denote working files.
24 Names are paired as explained in
25 .BR ci (1).
26 .PP
27 Revisions of an \*r file can be checked out locked or unlocked.  Locking a
28 revision prevents overlapping updates.  A revision checked out for reading or
29 processing (e.g., compiling) need not be locked.  A revision checked out
30 for editing and later checkin must normally be locked.  Checkout with locking
31 fails if the revision to be checked out is currently locked by another user.
32 (A lock can be broken with
33 .BR rcs "(1).)\ \&"
34 Checkout with locking also requires the caller to be on the access list of
35 the \*r file, unless he is the owner of the
36 file or the superuser, or the access list is empty.
37 Checkout without locking is not subject to accesslist restrictions, and is
38 not affected by the presence of locks.
39 .PP
40 A revision is selected by options for revision or branch number,
41 checkin date/time, author, or state.
42 When the selection options
43 are applied in combination,
44 .B co
45 retrieves the latest revision
46 that satisfies all of them.
47 If none of the selection options
48 is specified,
49 .B co
50 retrieves the latest revision
51 on the default branch (normally the trunk, see the
52 .B \-b
53 option of
54 .BR rcs (1)).
55 A revision or branch number can be attached
56 to any of the options
57 .BR \-f ,
58 .BR \-I ,
59 .BR \-l ,
60 .BR \-M ,
61 .BR \-p ,
62 .BR \-q ,
63 .BR \-r ,
64 or
65 .BR \-u .
66 The options
67 .B \-d
68 (date),
69 .B \-s
70 (state), and
71 .B \-w
72 (author)
73 retrieve from a single branch, the
74 .I selected
75 branch,
76 which is either specified by one of
77 .BR \-f ,
78 \&.\|.\|.,
79 .BR \-u ,
80 or the default branch.
81 .PP
82 A
83 .B co
84 command applied to an \*r
85 file with no revisions creates a zero-length working file.
86 .B co
87 always performs keyword substitution (see below).
88 .SH OPTIONS
89 .TP
90 .BR \-r [\f2rev\fP]
91 retrieves the latest revision whose number is less than or equal to
92 .IR rev .
93 If
94 .I rev
95 indicates a branch rather than a revision,
96 the latest revision on that branch is retrieved.
97 If
98 .I rev
99 is omitted, the latest revision on the default branch
100 (see the
101 .B \-b
102 option of
103 .BR rcs (1))
104 is retrieved.
105 If
106 .I rev
107 is
108 .BR $ ,
109 .B co
110 determines the revision number from keyword values in the working file.
111 Otherwise, a revision is composed of one or more numeric or symbolic fields
112 separated by periods.
113 If
114 .I rev
115 begins with a period,
116 then the default branch (normally the trunk) is prepended to it.
117 If
118 .I rev
119 is a branch number followed by a period,
120 then the latest revision on that branch is used.
121 The numeric equivalent of a symbolic field
122 is specified with the
123 .B \-n
124 option of the commands
125 .BR ci (1)
126 and
127 .BR rcs (1).
128 .TP
129 .BR \-l [\f2rev\fP]
130 same as
131 .BR \-r ,
132 except that it also locks the retrieved revision for
133 the caller.
134 .TP
135 .BR \-u [\f2rev\fP]
136 same as
137 .BR \-r ,
138 except that it unlocks the retrieved revision if it was
139 locked by the caller.  If
140 .I rev
141 is omitted,
142 .B \-u
143 retrieves the revision locked by the caller, if there is one; otherwise,
144 it retrieves the latest revision on the default branch.
145 .TP
146 .BR \-f [\f2rev\fP]
147 forces the overwriting of the working file;
148 useful in connection with
149 .BR \-q .
150 See also
151 .SM "FILE MODES"
152 below.
153 .TP
154 .B \-kkv
155 Generate keyword strings using the default form, e.g.\&
156 .B "$\&Revision: \*(Rv $"
157 for the
158 .B Revision
159 keyword.
160 A locker's name is inserted in the value of the
161 .BR Header ,
162 .BR Id ,
163 and
164 .B Locker
165 keyword strings
166 only as a file is being locked,
167 i.e. by
168 .B "ci\ \-l"
169 and
170 .BR "co\ \-l".
171 This is the default.
172 .TP
173 .B \-kkvl
174 Like
175 .BR \-kkv ,
176 except that a locker's name is always inserted
177 if the given revision is currently locked.
178 .TP
179 .B \-kk
180 Generate only keyword names in keyword strings; omit their values.
181 See
182 .SM "KEYWORD SUBSTITUTION"
183 below.
184 For example, for the
185 .B Revision
186 keyword, generate the string
187 .B $\&Revision$
188 instead of
189 .BR "$\&Revision: \*(Rv $" .
190 This option is useful to ignore differences due to keyword substitution
191 when comparing different revisions of a file.
192 Log messages are inserted after
193 .B $\&Log$
194 keywords even if
195 .B \-kk
196 is specified,
197 since this tends to be more useful when merging changes.
198 .TP
199 .B \-ko
200 Generate the old keyword string,
201 present in the working file just before it was checked in.
202 For example, for the
203 .B Revision
204 keyword, generate the string
205 .B "$\&Revision: 1.1 $"
206 instead of
207 .B "$\&Revision: \*(Rv $"
208 if that is how the string appeared when the file was checked in.
209 This can be useful for file formats
210 that cannot tolerate any changes to substrings
211 that happen to take the form of keyword strings.
212 .TP
213 .B \-kb
214 Generate a binary image of the old keyword string.
215 This acts like
216 .BR \-ko ,
217 except it performs all working file input and output in binary mode.
218 This makes little difference on Posix and Unix hosts,
219 but on DOS-like hosts one should use
220 .B "rcs\ \-i\ \-kb"
221 to initialize an \*r file intended to be used for binary files.
222 Also, on all hosts,
223 .BR rcsmerge (1)
224 normally refuses to merge files when
225 .B \-kb
226 is in effect.
227 .TP
228 .B \-kv
229 Generate only keyword values for keyword strings.
230 For example, for the
231 .B Revision
232 keyword, generate the string
233 .B \*(Rv
234 instead of
235 .BR "$\&Revision: \*(Rv $" .
236 This can help generate files in programming languages where it is hard to
237 strip keyword delimiters like
238 .B "$\&Revision:\ $"
239 from a string.
240 However, further keyword substitution cannot be performed once the
241 keyword names are removed, so this option should be used with care.
242 Because of this danger of losing keywords,
243 this option cannot be combined with
244 .BR \-l ,
245 and the owner write permission of the working file is turned off;
246 to edit the file later, check it out again without
247 .BR \-kv .
248 .TP
249 .BR \-p [\f2rev\fP]
250 prints the retrieved revision on the standard output rather than storing it
251 in the working file.
252 This option is useful when
253 .B co
254 is part of a pipe.
255 .TP
256 .BR \-q [\f2rev\fP]
257 quiet mode; diagnostics are not printed.
258 .TP
259 .BR \-I [\f2rev\fP]
260 interactive mode;
261 the user is prompted and questioned
262 even if the standard input is not a terminal.
263 .TP
264 .BI \-d date
265 retrieves the latest revision on the selected branch whose checkin date/time is
266 less than or equal to
267 .IR date .
268 The date and time can be given in free format.
269 The time zone
270 .B LT
271 stands for local time;
272 other common time zone names are understood.
273 For example, the following
274 .IR date s
275 are equivalent
276 if local time is January 11, 1990, 8pm Pacific Standard Time,
277 eight hours west of Coordinated Universal Time (\*u):
278 .RS
279 .LP
280 .RS
281 .nf
282 .ta \w'\f3Thu, 11 Jan 1990 20:00:00 \-0800\fP  'u
283 .ne 10
284 \f38:00 pm lt\fP
285 \f34:00 AM, Jan. 12, 1990\fP    default is \*u
286 \f31990-01-12 04:00:00+00\fP    \*i 8601 (\*u)
287 \f31990-01-11 20:00:00\-08\fP   \*i 8601 (local time)
288 \f31990/01/12 04:00:00\fP       traditional \*r format
289 \f3Thu Jan 11 20:00:00 1990 LT\fP       output of \f3ctime\fP(3) + \f3LT\fP
290 \f3Thu Jan 11 20:00:00 PST 1990\fP      output of \f3date\fP(1)
291 \f3Fri Jan 12 04:00:00 GMT 1990\fP
292 \f3Thu, 11 Jan 1990 20:00:00 \-0800\fP  Internet RFC 822
293 \f312-January-1990, 04:00 WET\fP
294 .ta 4n +4n +4n +4n
295 .fi
296 .RE
297 .LP
298 Most fields in the date and time can be defaulted.
299 The default time zone is normally \*u, but this can be overridden by the
300 .B \-z
301 option.
302 The other defaults are determined in the order year, month, day,
303 hour, minute, and second (most to least significant).  At least one of these
304 fields must be provided.  For omitted fields that are of higher significance
305 than the highest provided field, the time zone's current values are assumed.
306 For all other omitted fields,
307 the lowest possible values are assumed.
308 For example, without
309 .BR \-z ,
310 the date
311 .B "20, 10:30"
312 defaults to
313 10:30:00 \*u of the 20th of the \*u time zone's current month and year.
314 The date/time must be quoted if it contains spaces.
315 .RE
316 .TP
317 .BR \-M [\f2rev\fP]
318 Set the modification time on the new working file
319 to be the date of the retrieved revision.
320 Use this option with care; it can confuse
321 .BR make (1).
322 .TP
323 .BI \-s state
324 retrieves the latest revision on the selected branch whose state is set to
325 .IR state .
326 .TP
327 .B \-T
328 Preserve the modification time on the \*r file
329 even if the \*r file changes because a lock is added or removed.
330 This option can suppress extensive recompilation caused by a
331 .BR make (1)
332 dependency of some other copy of the working file on the \*r file.
333 Use this option with care; it can suppress recompilation even when it is needed,
334 i.e. when the change of lock
335 would mean a change to keyword strings in the other working file.
336 .TP
337 .BR \-w [\f2login\fP]
338 retrieves the latest revision on the selected branch which was checked in
339 by the user with login name
340 .IR login .
341 If the argument
342 .I login
343 is
344 omitted, the caller's login is assumed.
345 .TP
346 .BI \-j joinlist
347 generates a new revision which is the join of the revisions on
348 .IR joinlist .
349 This option is largely obsoleted by
350 .BR rcsmerge (1)
351 but is retained for backwards compatibility.
352 .RS
353 .PP
354 The
355 .I joinlist
356 is a comma-separated list of pairs of the form
357 .IB rev2 : rev3,
358 where
359 .I rev2
360 and
361 .I rev3
362 are (symbolic or numeric)
363 revision numbers.
364 For the initial such pair,
365 .I rev1
366 denotes the revision selected
367 by the above options
368 .BR \-f ,
369 \&.\|.\|.,
370 .BR \-w .
371 For all other pairs,
372 .I rev1
373 denotes the revision generated by the previous pair.
374 (Thus, the output
375 of one join becomes the input to the next.)
376 .PP
377 For each pair,
378 .B co
379 joins revisions
380 .I rev1
381 and
382 .I rev3
383 with respect to
384 .IR rev2 .
385 This means that all changes that transform
386 .I rev2
387 into
388 .I rev1
389 are applied to a copy of
390 .IR rev3 .
391 This is particularly useful if
392 .I rev1
393 and
394 .I rev3
395 are the ends of two branches that have
396 .I rev2
397 as a common ancestor.  If
398 .IR rev1 < rev2 < rev3
399 on the same branch,
400 joining generates a new revision which is like
401 .I rev3,
402 but with all changes that lead from
403 .I rev1
404 to
405 .I rev2
406 undone.
407 If changes from
408 .I rev2
409 to
410 .I rev1
411 overlap with changes from
412 .I rev2
413 to
414 .I rev3,
415 .B co
416 reports overlaps as described in
417 .BR merge (1).
418 .PP
419 For the initial pair,
420 .I rev2
421 can be omitted.  The default is the common
422 ancestor.
423 If any of the arguments indicate branches, the latest revisions
424 on those branches are assumed.
425 The options
426 .B \-l
427 and
428 .B \-u
429 lock or unlock
430 .IR rev1 .
431 .RE
432 .TP
433 .BI \-V
434 Print \*r's version number.
435 .TP
436 .BI \-V n
437 Emulate \*r version
438 .I n,
439 where
440 .I n
441 can be
442 .BR 3 ,
443 .BR 4 ,
444 or
445 .BR 5 .
446 This can be useful when interchanging \*r files with others who are
447 running older versions of \*r.
448 To see which version of \*r your correspondents are running, have them invoke
449 .BR "rcs \-V" ;
450 this works with newer versions of \*r.
451 If it doesn't work, have them invoke
452 .B rlog
453 on an \*r file;
454 if none of the first few lines of output contain the string
455 .B branch:
456 it is version 3;
457 if the dates' years have just two digits, it is version 4;
458 otherwise, it is version 5.
459 An \*r file generated while emulating version 3 loses its default branch.
460 An \*r revision generated while emulating version 4 or earlier has
461 a time stamp that is off by up to 13 hours.
462 A revision extracted while emulating version 4 or earlier contains
463 abbreviated dates of the form
464 .IB yy / mm / dd
465 and can also contain different white space and line prefixes
466 in the substitution for
467 .BR $\&Log$ .
468 .TP
469 .BI \-x "suffixes"
470 Use
471 .I suffixes
472 to characterize \*r files.
473 See
474 .BR ci (1)
475 for details.
476 .TP
477 .BI \-z zone
478 specifies the date output format in keyword substitution,
479 and specifies the default time zone for
480 .I date
481 in the
482 .BI \-d date
483 option.
484 The
485 .I zone
486 should be empty, a numeric \*u offset, or the special string
487 .B LT
488 for local time.
489 The default is an empty
490 .IR zone ,
491 which uses the traditional \*r format of \*u without any time zone indication
492 and with slashes separating the parts of the date;
493 otherwise, times are output in \*i 8601 format with time zone indication.
494 For example, if local time is January 11, 1990, 8pm Pacific Standard Time,
495 eight hours west of \*u,
496 then the time is output as follows:
497 .RS
498 .LP
499 .RS
500 .nf
501 .ta \w'\f3\-z+05:30\fP  'u +\w'\f31990-01-11 09:30:00+05:30\fP  'u
502 .ne 4
503 \f2option\fP    \f2time output\fP
504 \f3\-z\fP       \f31990/01/12 04:00:00\fP       \f2(default)\fP
505 \f3\-zLT\fP     \f31990-01-11 20:00:00\-08\fP
506 \f3\-z+05:30\fP \f31990-01-12 09:30:00+05:30\fP
507 .ta 4n +4n +4n +4n
508 .fi
509 .RE
510 .LP
511 The
512 .B \-z
513 option does not affect dates stored in \*r files,
514 which are always \*u.
515 .RE
516 .SH "KEYWORD SUBSTITUTION"
517 Strings of the form
518 .BI $ keyword $
519 and
520 .BI $ keyword : .\|.\|. $
521 embedded in
522 the text are replaced
523 with strings of the form
524 .BI $ keyword : value $
525 where
526 .I keyword
527 and
528 .I value
529 are pairs listed below.
530 Keywords can be embedded in literal strings
531 or comments to identify a revision.
532 .PP
533 Initially, the user enters strings of the form
534 .BI $ keyword $ .
535 On checkout,
536 .B co
537 replaces these strings with strings of the form
538 .BI $ keyword : value $ .
539 If a revision containing strings of the latter form
540 is checked back in, the value fields will be replaced during the next
541 checkout.
542 Thus, the keyword values are automatically updated on checkout.
543 This automatic substitution can be modified by the
544 .B \-k
545 options.
546 .PP
547 Keywords and their corresponding values:
548 .TP
549 .B $\&Author$
550 The login name of the user who checked in the revision.
551 .TP
552 .B $\&Date$
553 The date and time the revision was checked in.
554 With
555 .BI \-z zone
556 a numeric time zone offset is appended; otherwise, the date is \*u.
557 .TP
558 .B $\&Header$
559 A standard header containing the full pathname of the \*r file, the
560 revision number, the date and time, the author, the state,
561 and the locker (if locked).
562 With
563 .BI \-z zone
564 a numeric time zone offset is appended to the date; otherwise, the date is \*u.
565 .TP
566 .B $\&Id$
567 Same as
568 .BR $\&Header$ ,
569 except that the \*r filename is without a path.
570 .TP
571 .B $\&Locker$
572 The login name of the user who locked the revision (empty if not locked).
573 .TP
574 .B $\&Log$
575 The log message supplied during checkin, preceded by a header
576 containing the \*r filename, the revision number, the author, and the date
577 and time.
578 With
579 .BI \-z zone
580 a numeric time zone offset is appended; otherwise, the date is \*u.
581 Existing log messages are
582 .I not
583 replaced.
584 Instead, the new log message is inserted after
585 .BR $\&Log: .\|.\|. $ .
586 This is useful for
587 accumulating a complete change log in a source file.
588 .RS
589 .LP
590 Each inserted line is prefixed by the string that prefixes the
591 .B $\&Log$
592 line.  For example, if the
593 .B $\&Log$
594 line is
595 .RB \*(lq "//\ $\&Log: tan.cc\ $" \*(rq,
596 \*r prefixes each line of the log with
597 .RB \*(lq "//\ " \*(rq.
598 This is useful for languages with comments that go to the end of the line.
599 The convention for other languages is to use a
600 .RB \*(lq " \(** " \(rq
601 prefix inside a multiline comment.
602 For example, the initial log comment of a C program
603 conventionally is of the following form:
604 .RS
605 .LP
606 .nf
607 .ft 3
608 .ne 3
609 /\(**
610 .in +\w'/'u
611 \(** $\&Log$
612 \(**/
613 .in
614 .ft
615 .fi
616 .RE
617 .LP
618 For backwards compatibility with older versions of \*r, if the log prefix is
619 .B /\(**
620 or
621 .B (\(**
622 surrounded by optional white space, inserted log lines contain a space
623 instead of
624 .B /
625 or
626 .BR ( ;
627 however, this usage is obsolescent and should not be relied on.
628 .RE
629 .TP
630 .B $\&Name$
631 The symbolic name used to check out the revision, if any.
632 For example,
633 .B "co\ \-rJoe"
634 generates
635 .BR "$\&Name:\ Joe\ $" .
636 Plain
637 .B co
638 generates just
639 .BR "$\&Name:\ \ $" .
640 .TP
641 .B $\&RCSfile$
642 The name of the \*r file without a path.
643 .TP
644 .B $\&Revision$
645 The revision number assigned to the revision.
646 .TP
647 .B $\&Source$
648 The full pathname of the \*r file.
649 .TP
650 .B $\&State$
651 The state assigned to the revision with the
652 .B \-s
653 option of
654 .BR rcs (1)
655 or
656 .BR ci (1).
657 .PP
658 The following characters in keyword values are represented by escape sequences
659 to keep keyword strings well-formed.
660 .LP
661 .RS
662 .nf
663 .ne 6
664 .ta \w'newline  'u
665 \f2char escape sequence\fP
666 tab     \f3\et\fP
667 newline \f3\en\fP
668 space   \f3\e040
669 $       \e044
670 \e      \e\e\fP
671 .fi
672 .RE
673 .SH "FILE MODES"
674 The working file inherits the read and execute permissions from the \*r
675 file.  In addition, the owner write permission is turned on, unless
676 .B \-kv
677 is set or the file
678 is checked out unlocked and locking is set to strict (see
679 .BR rcs (1)).
680 .PP
681 If a file with the name of the working file exists already and has write
682 permission,
683 .B co
684 aborts the checkout,
685 asking beforehand if possible.
686 If the existing working file is
687 not writable or
688 .B \-f
689 is given, the working file is deleted without asking.
690 .SH FILES
691 .B co
692 accesses files much as
693 .BR ci (1)
694 does, except that it does not need to read the working file
695 unless a revision number of
696 .B $
697 is specified.
698 .SH ENVIRONMENT
699 .TP
700 .B \s-1RCSINIT\s0
701 options prepended to the argument list, separated by spaces.
702 See
703 .BR ci (1)
704 for details.
705 .SH DIAGNOSTICS
706 The \*r pathname, the working pathname,
707 and the revision number retrieved are
708 written to the diagnostic output.
709 The exit status is zero if and only if all operations were successful.
710 .SH IDENTIFICATION
711 Author: Walter F. Tichy.
712 .br
713 Manual Page Revision: \*(Rv; Release Date: \*(Dt.
714 .br
715 Copyright \(co 1982, 1988, 1989 Walter F. Tichy.
716 .br
717 Copyright \(co 1990, 1991, 1992, 1993, 1994, 1995 Paul Eggert.
718 .SH "SEE ALSO"
719 rcsintro(1), ci(1), ctime(3), date(1), ident(1), make(1),
720 rcs(1), rcsclean(1), rcsdiff(1), rcsmerge(1), rlog(1),
721 rcsfile(5)
722 .br
723 Walter F. Tichy,
724 \*r\*-A System for Version Control,
725 .I "Software\*-Practice & Experience"
726 .BR 15 ,
727 7 (July 1985), 637-654.
728 .SH LIMITS
729 Links to the \*r and working files are not preserved.
730 .PP
731 There is no way to selectively suppress the expansion of keywords, except
732 by writing them differently.  In nroff and troff, this is done by embedding the
733 null-character
734 .B \e&
735 into the keyword.
736 .br