source: trunk/third/rcs/man/co.1 @ 9047

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