Debian Codegraph @

upstream/debian-unstable/man1/co.1

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