Annotation of src/usr.bin/rcs/rcs.1, Revision 1.40
1.40 ! jmc 1: .\" $OpenBSD: rcs.1,v 1.39 2006/04/27 09:49:50 jmc Exp $
1.1 deraadt 2: .\"
3: .\" Copyright (c) 2005 Jean-Francois Brousseau <jfb@openbsd.org>
1.22 jmc 4: .\" Copyright (c) 2005 Xavier Santolaria <xsa@openbsd.org>
1.1 deraadt 5: .\" All rights reserved.
6: .\"
7: .\" Redistribution and use in source and binary forms, with or without
8: .\" modification, are permitted provided that the following conditions
9: .\" are met:
10: .\"
11: .\" 1. Redistributions of source code must retain the above copyright
12: .\" notice, this list of conditions and the following disclaimer.
13: .\" 2. The name of the author may not be used to endorse or promote products
14: .\" derived from this software without specific prior written permission.
15: .\"
16: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
17: .\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
18: .\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
19: .\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20: .\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21: .\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22: .\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23: .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24: .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25: .\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26: .\"
27: .Dd May 16, 2004
28: .Dt RCS 1
29: .Os
30: .Sh NAME
31: .Nm rcs
32: .Nd RCS file management program
33: .Sh SYNOPSIS
34: .Nm
1.37 jmc 35: .Op Fl ehIiLqTUV
1.14 xsa 36: .Op Fl A Ns Ar oldfile
1.7 niallo 37: .Op Fl a Ns Ar users
38: .Op Fl b Ns Op Ar rev
1.12 xsa 39: .Op Fl c Ns Ar string
1.7 niallo 40: .Op Fl e Ns Op Ar users
1.9 xsa 41: .Op Fl k Ns Ar mode
1.24 ray 42: .Op Fl l Ns Op Ar rev
1.33 jmc 43: .Oo Fl m Ns Ar rev :
1.20 xsa 44: .Ar msg Oc
1.19 xsa 45: .Op Fl o Ns Ar rev
1.20 xsa 46: .Oo Fl s Ns Ar state Ns
47: .Op : Ns Ar rev Oc
1.14 xsa 48: .Oo Fl t Ns Ar file Ns \*(Ba
49: .Ar str Oc
1.24 ray 50: .Op Fl u Ns Op Ar rev
1.15 xsa 51: .Op Fl x Ns Ar suffixes
1.30 jmc 52: .Ar
1.1 deraadt 53: .Sh DESCRIPTION
1.22 jmc 54: Revision Control System (RCS) is a software tool which lets people
55: manage multiple revisions of text that is revised frequently, such as
56: source code or documentation.
57: .Pp
1.1 deraadt 58: The
59: .Nm
60: program is used to create RCS files or manipulate the contents of existing
61: files.
1.22 jmc 62: A set of helper tools is also available:
63: specific revisions of files may be checked in or out, using
64: .Xr ci 1
65: and
66: .Xr co 1 ;
67: differences between revisions viewed or merged, using
68: .Xr rcsdiff 1
69: and
70: .Xr rcsmerge 1 ;
71: and information about RCS files and keyword strings displayed using
72: .Xr rlog 1
73: and
74: .Xr ident 1 .
75: See the respective manual pages for more information
76: about these utilities.
1.1 deraadt 77: .Pp
1.39 jmc 78: Files may be selected by
79: .Em revision
80: or, where no revision is specified,
1.34 jmc 81: the latest revision of the default branch is used.
82: Revisions are specified either by using the
83: .Fl r
84: option or
85: by appending the revision number to any option that supports it.
1.38 jmc 86: .Pp
87: .Nm
88: supports the notion of
89: .Em state .
90: The state is an arbitrary string of characters used to describe a file
91: (or a specific revision of a file).
92: States can be set or changed using the
93: .Fl s
94: option, for RCS tools which support it.
95: The state of a file/revision can be modified without having to check in
96: a new file/revision.
97: The default state is
98: .Sq Exp
99: (Experimental).
100: Examples of states could be
101: .Sq Dev ,
102: .Sq Reviewed ,
103: or
104: .Sq Stab .
1.34 jmc 105: .Pp
1.25 jmc 106: .Nm
107: also supports
108: keyword substitution \(en
109: see
110: .Sx KEYWORD SUBSTITUTION ,
111: below, for more information.
112: .Pp
1.1 deraadt 113: The following options are supported:
114: .Bl -tag -width "-e usersXX"
1.14 xsa 115: .It Fl A Ns Ar oldfile
116: Append the access list of
117: .Ar oldfile
118: to the access list of the RCS files.
1.7 niallo 119: .It Fl a Ns Ar users
1.1 deraadt 120: Add the usernames specified in the comma-separated list
121: .Ar users
122: to the access list of the RCS files.
1.7 niallo 123: .It Fl b Ns Op Ar rev
1.14 xsa 124: Set the default branch to
125: .Ar rev .
1.12 xsa 126: .It Fl c Ns Ar string
127: Set comment leader to
128: .Ar string .
1.7 niallo 129: .It Fl e Ns Op Ar users
1.1 deraadt 130: Remove the usernames specified in the comma-separated list
131: .Ar users
132: from the access list of the RCS files.
133: If
134: .Ar users
135: is not specified, all users are removed from the access list.
136: .It Fl h
137: Display the program's usage and exit.
1.20 xsa 138: .It Fl I
139: Interactive mode.
1.1 deraadt 140: .It Fl i
1.10 xsa 141: Create and initialize a new RCS file.
1.11 jmc 142: If the RCS file has no path prefix, try to first create it in the
1.10 xsa 143: .Pa ./RCS
1.11 jmc 144: subdirectory or, if that fails, in the current directory.
1.1 deraadt 145: Files created this way contain no revision.
1.9 xsa 146: .It Fl k Ns Ar mode
147: Specify the keyword substitution mode.
1.1 deraadt 148: .It Fl L
149: Enable strict locking on the RCS files.
1.24 ray 150: .It Fl l Ns Op Ar rev
151: Lock revision
152: .Ar rev
153: on the RCS files.
1.7 niallo 154: .It Fl m Ns Ar rev : Ns Ar msg
1.5 jmc 155: Replace revision
156: .Ar rev Ns 's
157: log message with
158: .Ar msg .
1.19 xsa 159: .It Fl o Ns Ar rev
160: Delete one or more revisions.
161: The specifications of the values or revisions are as follows:
162: .Bl -tag -width Ds
163: .It rev
164: Specific revision.
165: .It rev1:rev2
166: Delete all revisions of a branch between
167: .Ar rev1
168: and
169: .Ar rev2 .
170: .It rev1::rev2
171: Delete all revisions of a branch between
172: .Ar rev1
173: and
174: .Ar rev2
175: without deleting revisions
176: .Ar rev1
177: and
178: .Ar rev2 .
179: .It :rev
180: Delete all revisions of the branch until revision
181: .Ar rev .
182: .It rev:
183: Delete all revisions of the branch from revision
184: .Ar rev
185: until the last revision of the branch.
186: .El
1.13 xsa 187: .It Fl q
188: Be quiet about reporting.
1.14 xsa 189: .Sm off
1.20 xsa 190: .It Fl s Ar state Op : Ar rev
191: .Sm on
192: Sets the state of revision
193: .Ar rev
194: to the identifier
195: .Ar state .
196: The specified value may not contain a space character.
1.16 xsa 197: .It Fl T
1.17 jmc 198: Preserve the modification time of RCS files.
1.20 xsa 199: .Sm off
1.14 xsa 200: .It Fl t Ar file \*(Ba Ar str
201: .Sm on
202: Change the descriptive text.
203: The descriptive text is taken from the
204: .Ar file
205: specified as argument or from the string
206: .Ar str
207: given as argument if it is preceded by the
208: .Sq -
209: character.
210: If no argument is used, the descriptive text is taken from standard input
211: terminated by end-of-file or by a line containing the
212: .Sq \&.
213: character by itself.
1.1 deraadt 214: .It Fl U
215: Disable strict locking on the RCS files.
1.24 ray 216: .It Fl u Ns Op Ar rev
217: Unlock revision
218: .Ar rev
219: on the RCS files.
1.1 deraadt 220: .It Fl V
221: Print the program's version string and exit.
1.15 xsa 222: .It Fl x Ns Ar suffixes
223: Specifies the suffixes for RCS files.
224: Suffixes should be separated by the
225: .Sq /
226: character.
1.25 jmc 227: .El
228: .Sh KEYWORD SUBSTITUTION
1.40 ! jmc 229: As long as source files are edited inside a working directory,
! 230: their state can be determined using the
1.27 jmc 231: .Xr cvs 1
1.25 jmc 232: .Ic status
233: or
234: .Ic log
235: commands, but as soon as files get exported from
1.40 ! jmc 236: a local working copy, it becomes harder to identify which
1.25 jmc 237: revisions they are.
238: .Pp
239: .Nm
240: and
241: .Xr cvs 1
1.40 ! jmc 242: use a mechanism known as
1.25 jmc 243: .Sq keyword substitution
244: to help identify the files.
245: Embedded strings of the form $keyword$ and $keyword:...$ in a file
1.40 ! jmc 246: are replaced with strings of the form $keyword: value$ whenever
! 247: a new revision of the file is obtained.
1.25 jmc 248: The possible keywords are as follows:
1.30 jmc 249: .Bl -tag -width "XrevisionXX" -offset "XXX"
1.25 jmc 250: .It $\&Author$
251: The name of the user who checked in the revision.
252: .It $\&Date$
253: The date and hour (UTC) the revision was checked in.
254: .It $\&Header$
255: Standard header containing the full pathname of the RCS
256: file, the revision number, the date (UTC), the author and the state.
257: .It $\&Id$
258: The same content as $\&Header$ but without the path
259: of the RCS file.
260: .It $\&Log$
261: The log message supplied during commit, preceded by a header
262: containing the RCS filename, the revision number, the
263: author, and the date (UTC).
264: .It $\&Name$
265: The tag name used to check out the file.
266: .It $\&RCSfile$
267: The name of the RCS file, but without a path.
268: .It $\&Revision$
269: The revision number assigned to the revision.
270: .It $\&Source$
271: The full pathname of the RCS file.
272: .It $\&State$
273: The state assigned to the revision.
274: .El
275: .Pp
276: Keyword substitution has its disadvantages: sometimes the
277: literal text string $\&Author$ is wanted inside a file without
278: .Nm
1.27 jmc 279: or
280: .Xr cvs 1
1.25 jmc 281: interpreting it as a keyword and expanding it into something like
282: $\&Author$.
283: The
1.26 jmc 284: .Fl k Ns Ar o
1.25 jmc 285: option can be used to turn off keyword substitution entirely though.
286: There is unfortunately no way to selectively turn off keyword substitution.
287: .Pp
288: Each file and working directory copy of a file have a stored
289: default substitution mode.
290: Substitution modes on files are set by the
291: .Fl k Ns Ar mode
292: option.
293: .Pp
294: The possible substitution modes are as follows:
295: .Bl -tag -width Ds -offset 3n
1.26 jmc 296: .It Fl k Ns Ar b
1.25 jmc 297: Like
1.26 jmc 298: .Fl k Ns Ar o ,
1.25 jmc 299: but also avoids the conversion of line endings.
300: This option is used to handle binary files.
1.26 jmc 301: .It Fl k Ns Ar k
1.25 jmc 302: Does not substitute the keywords.
303: Useful with the
1.27 jmc 304: .Xr cvs 1
1.25 jmc 305: .Ic diff
1.28 jmc 306: and
307: .Xr rcsdiff 1
308: commands to avoid displaying the differences between keyword substitutions.
1.26 jmc 309: .It Fl k Ns Ar kv
1.25 jmc 310: The default behaviour.
311: Keywords are normally substituted i.e. $\&Revision$ becomes
312: $\&Revision: 1.1 $.
1.26 jmc 313: .It Fl k Ns Ar kvl
1.25 jmc 314: Like
1.26 jmc 315: .Fl k Ns Ar kv ,
1.25 jmc 316: except that the locker's name is displayed along with the version
317: if the given revision is currently locked.
318: This option is normally not useful as
319: .Nm
1.27 jmc 320: and
321: .Xr cvs 1
322: do not use file locking by default.
1.26 jmc 323: .It Fl k Ns Ar o
1.25 jmc 324: No substitutions are done.
325: This option is often used with the
1.27 jmc 326: .Xr cvs 1
1.25 jmc 327: .Ic import
328: command to guarantee that files that already contain external keywords
329: do not get modified.
1.26 jmc 330: .It Fl k Ns Ar v
1.25 jmc 331: Substitute the value of keywords instead of keywords themselves
332: e.g. instead of $\&Revision$, only insert 1.1 and not $\&Revision: 1.1 $.
333: This option must be used with care, as it can only be used once.
334: It is often used with the
1.27 jmc 335: .Xr cvs 1
1.25 jmc 336: .Ic export
337: command to freeze the values before releasing software.
1.1 deraadt 338: .El
339: .Sh ENVIRONMENT
340: .Bl -tag -width RCSINIT
341: .It Ev RCSINIT
342: If set, this variable should contain a list of space-delimited options that
343: are prepended to the argument list.
344: .El
1.22 jmc 345: .Sh EXAMPLES
346: One of the most common uses of
347: .Nm
348: is to track changes to a document containing source code.
349: .Pp
350: As an example,
351: we'll look at a user wishing to track source changes to a file
352: .Ar foo.c .
353: .Pp
354: If the
355: .Ar RCS
356: directory does not exist yet, create it as follows and invoke the
357: check-in command:
358: .Bd -literal -offset indent
359: $ mkdir RCS
360: $ ci foo.c
361: .Ed
362: .Pp
363: This command creates an RCS file
364: .Ar foo.c,v
365: in the
366: .Ar RCS
367: directory, stores
368: .Ar foo.c
369: into it as revision 1.1, and deletes
370: .Ar foo.c .
371: .Xr ci 1
372: will prompt for a description of the file to be entered.
373: Whenever a newly created (or updated) file is checked-in,
374: .Xr ci 1
375: will prompt for a log message to be entered which should summarize
376: the changes made to the file.
377: That log message will be added to the RCS file along with the new revision.
378: .Pp
379: The
380: .Xr co 1
381: command can now be used to obtain a copy of the checked-in
382: .Ar foo.c,v
383: file:
384: .Pp
385: .Dl $ co foo.c
386: .Pp
1.36 jmc 387: This command checks the file out in unlocked mode.
1.22 jmc 388: If a user wants to have exclusive access to the file to make changes to it,
389: it needs to be checked out in locked mode using the
390: .Fl l
391: option of the
392: .Xr co 1
393: command.
394: Only one concurrent locked checkout of a revision is permitted.
395: .Pp
396: Once changes have been made to the
397: .Pa foo.c
398: file, and before checking the file in, the
399: .Xr rcsdiff 1
400: command can be used to view changes between the working file
401: and the most recently checked-in revision:
402: .Pp
403: .Dl $ rcsdiff -u foo.c
404: .Pp
405: The
406: .Fl u
407: option produces a unified diff.
408: See
409: .Xr diff 1
410: for more information.
1.1 deraadt 411: .Sh SEE ALSO
412: .Xr ci 1 ,
413: .Xr co 1 ,
1.3 jmc 414: .Xr ident 1 ,
1.1 deraadt 415: .Xr rcsclean 1 ,
416: .Xr rcsdiff 1 ,
1.8 xsa 417: .Xr rcsmerge 1 ,
1.6 xsa 418: .Xr rlog 1
1.21 jmc 419: .Sh STANDARDS
1.31 jmc 420: OpenRCS is compatible with
421: Walter Tichy's original RCS implementation.
422: .Pp
1.37 jmc 423: The flags
424: .Op Fl Mz
425: have no effect and are provided
1.21 jmc 426: for compatibility only.
1.32 jmc 427: .Sh HISTORY
428: The OpenRCS project is a BSD-licensed rewrite of the original
429: Revision Control System.
430: OpenRCS is written by Jean-Francois Brousseau, Joris Vink,
431: Niall O'Higgins, and Xavier Santolaria.
1.35 jmc 432: .Pp
1.32 jmc 433: The original RCS code was written in large parts by Walter F. Tichy
434: and Paul Eggert.
1.29 jmc 435: .Sh CAVEATS
436: For historical reasons,
437: the RCS tools do not permit whitespace between options and their arguments.