This commit was manufactured by cvs2svn to create tag 'FreeBSD-release/1.0'.
[unix-history] / share / doc / ps1 / 13.rcs / rcs.ms
CommitLineData
15637ed4
RG
1.\" Copyright (c) 1986 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Walter Tichy.
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.\" 1. Redistributions of source code must retain the above copyright
11.\" notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\" notice, this list of conditions and the following disclaimer in the
14.\" documentation and/or other materials provided with the distribution.
15.\" 3. All advertising materials mentioning features or use of this software
16.\" must display the following acknowledgement:
17.\" This product includes software developed by the University of
18.\" California, Berkeley and its contributors.
19.\" 4. Neither the name of the University nor the names of its contributors
20.\" may be used to endorse or promote products derived from this software
21.\" without specific prior written permission.
22.\"
23.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33.\" SUCH DAMAGE.
34.\"
35.\" @(#)rcs.ms 6.2 (Berkeley) 4/17/91
36.\"
37.OH 'Introduction to RCS''PS1:13-%'
38.EH 'PS1:13-%''Introduction to RCS'
39.TL
40An Introduction to the Revision Control System
41.AU
42Walter F. Tichy
43.AI
44Department of Computer Sciences
45Purdue University
46West Lafayette, IN 47907
47.AB
48The Revision Control System (RCS) manages software libraries.
49It greatly increases programmer productivity
50by centralizing and cataloging changes to a software project.
51This document describes the benefits of using a source code control system.
52It then gives a tutorial introduction to the use of RCS.
53.AE
54.SH
55Functions of RCS
56.PP
57The Revision Control System (RCS) manages multiple revisions of text files.
58RCS automates the storing, retrieval, logging, identification, and merging
59of revisions. RCS is useful for text that is revised frequently, for example
60programs, documentation, graphics, papers, form letters, etc.
61It greatly increases programmer productivity
62by providing the following functions.
63.IP 1.
64RCS stores and retrieves multiple revisions of program and other text.
65Thus, one can maintain one or more releases while developing the next
66release, with a minimum of space overhead. Changes no longer destroy the
67original -- previous revisions remain accessible.
68.RS
69.IP a.
70Maintains each module as a tree of revisions.
71.IP b.
72Project libraries can
73be organized centrally, decentralized, or any way you like.
74.IP c.
75RCS works for any type of text: programs, documentation, memos, papers,
76graphics, VLSI layouts, form letters, etc.
77.RE
78.IP 2.
79RCS maintains a complete history of changes.
80Thus, one can find out what happened to a module easily
81and quickly, without having to compare source listings or
82having to track down colleagues.
83.RS
84.IP a.
85RCS performs automatic record keeping.
86.IP b.
87RCS logs all changes automatically.
88.IP c.
89RCS guarantees project continuity.
90.RE
91.IP 3.
92RCS manages multiple lines of development.
93.IP 4.
94RCS can merge multiple lines of development.
95Thus, when several parallel lines of development must be consolidated
96into one line, the merging of changes is automatic.
97.IP 5.
98RCS flags coding conflicts.
99If two or more lines of development modify the same section of code,
100RCS can alert programmers about overlapping changes.
101.IP 6.
102RCS resolves access conflicts.
103When two or more programmers wish to modify the same revision,
104RCS alerts the programmers and makes sure that one change will not wipe
105out the other one.
106.IP 7.
107RCS provides high-level retrieval functions.
108Revisions can be retrieved according to ranges of revision numbers,
109symbolic names, dates, authors, and states.
110.IP 8.
111RCS provides release and configuration control.
112Revisions can be marked as released, stable, experimental, etc.
113Configurations of modules can be described simply and directly.
114.IP 9.
115RCS performs automatic identification of modules with name, revision
116number, creation time, author, etc.
117Thus, it is always possible to determine which revisions of which
118modules make up a given configuration.
119.IP 10.
120Provides high-level management visibility.
121Thus, it is easy to track the status of a software project.
122.RS
123.IP a.
124RCS provides a complete change history.
125.IP b.
126RCS records who did what when to which revision of which module.
127.RE
128.IP 11.
129RCS is fully compatible with existing software development tools.
130RCS is unobtrusive -- its interface to the file system is such that
131all your existing software tools can be used as before.
132.IP 12.
133RCS' basic user interface is extremely simple. The novice only
134needs to learn two commands. Its more sophisticated features have been
135tuned towards advanced software development environments and the
136experienced software professional.
137.IP 13.
138RCS simplifies software distribution if customers
139also maintain sources with RCS. This technique assures proper
140identification of versions and configurations, and tracking of customer
141changes. Customer changes can be merged into distributed
142versions locally or by the development group.
143.IP 14.
144RCS needs little extra space for the revisions (only the differences).
145If intermediate revisions are deleted, the corresponding
146differences are compressed into the shortest possible form.
147.SH
148Getting Started with RCS
149.PP
150Suppose you have a file f.c that you wish to put under control of RCS.
151Invoke the checkin command:
152.DS
153ci f.c
154.DE
155This command creates f.c,v, stores f.c into it as revision 1.1, and
156deletes f.c.
157It also asks you for a description. The description should be
158a synopsis of the contents of the file.
159All later checkin commands will ask you for a log entry,
160which should summarize the changes that you made.
161.PP
162Files ending in ,v are called RCS files ("v" stands for "versions"),
163the others are called working files.
164To get back the working file f.c in the previous example, use the checkout
165command:
166.DS
167co f.c
168.DE
169This command extracts the latest revision from f.c,v and writes
170it into f.c.
171You can now edit f.c and check it in back in by invoking:
172.DS
173ci f.c
174.DE
175\fICi\fR increments the revision number properly.
176If \fIci\fR complains with the message
177.DS
178 ci error: no lock set by <your login>
179.DE
180then your system administrator has decided to create all RCS files
181with the locking attribute set to ``strict''.
182With strict locking, you you must lock the revision during
183the previous checkout.
184Thus, your last checkout should have been
185.DS
186co -l f.c
187.DE
188Locking assures that you, and only you, can check in the next update, and
189avoids nasty problems if several people work on the same file.
190Of course, it is too late now to do the checkout with locking, because you
191probably modified f.c already, and a second checkout would
192overwrite your changes. Instead, invoke
193.DS
194rcs -l f.c
195.DE
196This command will lock the latest revision for you, unless somebody
197else got ahead of you already.
198If someone else has the lock you will have to negotiate your changes
199with them.
200.PP
201If your RCS file is private, i.e., if you are the only person who is going
202to deposit revisions into it, strict locking is not needed and you
203can turn it off.
204If strict locking is turned off,
205the owner off the RCS file need not have a lock for checkin; all others
206still do. Turning strict locking off and on is done with the commands:
207.DS
208rcs -U f.c and rcs -L f.c
209.DE
210You can set the locking to strict or non-strict on every RCS file.
211.PP
212If you do not want to clutter your working directory with RCS files, create
213a subdirectory called RCS in your working directory, and move all your RCS
214files there. RCS commands will look first into that directory to find
215needed files. All the commands discussed above will still work, without any
216change*.
217.FS
218* Pairs of RCS and working files can really be specified in 3 ways:
219a) both are given, b) only the working file is given, c) only the
220RCS file is given. Both files may have arbitrary path prefixes;
221RCS commands pair them up intelligently.
222.FE
223.PP
224To avoid the deletion of the working file during checkin (should you want to
225continue editing), invoke
226.DS
227ci -l f.c
228.DE
229This command checks in f.c as usual, but performs an additional
230checkout with locking.
231Thus, it saves you one checkout operation.
232There is also an option
233\fB-u\fR for \fIci\fR that does a checkin followed by a checkout without
234locking. This is useful if you want to compile the file after the checkin.
235Both options also update the identification markers in your file (see below).
236.PP
237You can give \fIci\fR the number you want assigned to a checked in
238revision. Assume all your revisions were numbered 1.1, 1.2, 1.3, etc.,
239and you would like to start release 2.
240The command
241.DS
242ci -r2 f.c or ci -r2.1 f.c
243.DE
244assigns the number 2.1 to the new revision.
245From then on, \fIci\fR will number the subsequent revisions
246with 2.2, 2.3, etc. The corresponding \fIco\fR commands
247.DS
248co -r2 f.c and co -r2.1 f.c
249.DE
250retrieve the latest revision numbered 2.x and the revision 2.1,
251respectively. \fICo\fR without a revision number selects
252the latest revision on the "trunk", i.e., the highest
253revision with a number consisting of 2 fields. Numbers with more than 2
254fields are needed for branches.
255For example, to start a branch at revision 1.3, invoke
256.DS
257 ci -r1.3.1 f.c
258.DE
259This command starts a branch numbered 1 at revision 1.3, and assigns
260the number 1.3.1.1 to the new revision. For more information about
261branches, see \fIrcsfile\fR(5).
262.SH
263Automatic Identification
264.PP
265RCS can put special strings for identification into your source and object
266code. To obtain such identification, place the marker
267.DS
78ed81a3 268/b/source/CVS/src/share/doc/ps1/13.rcs/rcs.ms,v 1.1.1.1 1993/03/21 09:48:22 cgd Exp
15637ed4
RG
269.DE
270into your text, for instance inside a comment.
271RCS will replace this marker with a string of the form
272.DS
78ed81a3 273/b/source/CVS/src/share/doc/ps1/13.rcs/rcs.ms,v 1.1.1.1 1993/03/21 09:48:22 cgd Exp
15637ed4
RG
274.DE
275You never need to touch this string, because RCS keeps it
276up to date automatically.
277To propagate the marker into your object code, simply put
278it into a literal character string. In C, this is done as follows:
279.DS
78ed81a3 280static char rcsid[] = "/b/source/CVS/src/share/doc/ps1/13.rcs/rcs.ms,v 1.1.1.1 1993/03/21 09:48:22 cgd Exp";
15637ed4
RG
281.DE
282The command \fIident\fR extracts such markers from any file, even object code.
283Thus, \fIident\fR helps you to find out
284which revisions of which modules were used in a given program.
285.PP
286You may also find it useful to put the marker
287.DS
78ed81a3 288rcs.ms,v
289.\" Revision 1.1.1.1 1993/03/21 09:48:22 cgd
290.\" initial import of 386bsd-0.1 sources
291.\"
15637ed4
RG
292.DE
293into your text, inside a comment. This marker accumulates
294the log messages that are requested during checkin.
295Thus, you can maintain the complete history of your file directly inside it.
296There are several additional identification markers; see \fIco\fR (1) for
297details.
298.SH
299How to combine MAKE and RCS
300.PP
301If your RCS files are in the same directory as your working files,
302you can put a default rule into your makefile. Do not use a rule
303of the form .c,v.c, because such a rule keeps a copy of every
304working file checked out, even those you are not working on. Instead, use this:
305.DS
306
307 .SUFFIXES: .c,v
308
309 .c,v.o:
310 co -q $*.c
311 cc $(CFLAGS) -c $*.c
312 rm -f $*.c
313
314 prog: f1.o f2.o .....
315 cc f1.o f2.o ..... -o prog
316.DE
317This rule has the following effect. If a file f.c does not exist, and f.o
318is older than f.c,v, MAKE checks out f.c, compiles f.c into f.o, and then
319deletes f.c.
320From then on, MAKE will use f.o until you change f.c,v.
321.PP
322If f.c exists (presumably because you are working on it), the default
323rule .c.o takes precedence, and f.c is compiled into f.o, but not deleted.
324.PP
325If you keep your RCS file in the directory ./RCS, all this will not work
326and you have to write explicit checkout rules for every file, like
327.DS
328f1.c: RCS/f1.c,v; co -q f1.c
329.DE
330Unfortunately, these rules do not
331have the property of removing unneeded .c-files.
332.SH
333Additional Information on RCS
334.PP
335If you want to know more about RCS, for example how to work
336with a tree of revisions and how to use symbolic revision numbers, read
337the following paper:
338.sp 1
339Walter F. Tichy, ``Design, Implementation, and Evaluation of a
340Revision Control System,'' in \fIProceedings of the 6th International
341Conference on Software Engineering\fR, IEEE, Tokyo, Sept. 1982.
342.PP
343Taking a look at the manual page \fIRCSFILE\fP(5)
344should also help to understand the revision tree permitted by RCS.