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