summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/rcs/man/rcsintro.1
blob: 3f140b3314abe6622dc230770808c6e72f8824c1 (plain)
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
.de Id
.ds Rv \\$3
.ds Dt \\$4
..
.Id $Id: rcsintro.1,v 1.1 1996/08/12 04:07:55 millert Exp $
.ds r \&\s-1RCS\s0
.if n .ds - \%--
.if t .ds - \(em
.if !\n(.g \{\
.	if !\w|\*(lq| \{\
.		ds lq ``
.		if \w'\(lq' .ds lq "\(lq
.	\}
.	if !\w|\*(rq| \{\
.		ds rq ''
.		if \w'\(rq' .ds rq "\(rq
.	\}
.\}
.am SS
.LP
..
.TH RCSINTRO 1 \*(Dt GNU
.SH NAME
rcsintro \- introduction to RCS commands
.SH DESCRIPTION
The Revision Control System (\*r) manages multiple revisions of files.
\*r automates the storing, retrieval, logging, identification, and merging
of revisions.  \*r is useful for text that is revised frequently, for example
programs, documentation, graphics, papers, and form letters.
.PP
The basic user interface is extremely simple.  The novice only needs
to learn two commands:
.BR ci (1)
and
.BR co (1).
.BR ci ,
short for \*(lqcheck in\*(rq, deposits the contents of a
file into an archival file called an \*r file.  An \*r file
contains all revisions of a particular file.
.BR co ,
short for \*(lqcheck out\*(rq, retrieves revisions from an \*r file.
.SS "Functions of \*r"
.IP \(bu
Store and retrieve multiple revisions of text.  \*r saves all old
revisions in a space efficient way.
Changes no longer destroy the original, because the
previous revisions remain accessible.  Revisions can be retrieved according to
ranges of revision numbers, symbolic names, dates, authors, and
states.
.IP \(bu
Maintain a complete history of changes.
\*r logs all changes automatically.
Besides the text of each revision, \*r stores the author, the date and time of
check-in, and a log message summarizing the change.
The logging makes it easy to find out
what happened to a module, without having to compare
source listings or having to track down colleagues.
.IP \(bu
Resolve access conflicts.  When two or more programmers wish to
modify the same revision, \*r alerts the programmers and prevents one
modification from corrupting the other.
.IP \(bu
Maintain a tree of revisions.  \*r can maintain separate lines of development
for each module.  It stores a tree structure that represents the
ancestral relationships among revisions.
.IP \(bu
Merge revisions and resolve conflicts.
Two separate lines of development of a module can be coalesced by merging.
If the revisions to be merged affect the same sections of code, \*r alerts the
user about the overlapping changes.
.IP \(bu
Control releases and configurations.
Revisions can be assigned symbolic names
and marked as released, stable, experimental, etc.
With these facilities, configurations of modules can be
described simply and directly.
.IP \(bu
Automatically identify each revision with name, revision number,
creation time, author, etc.
The identification is like a stamp that can be embedded at an appropriate place
in the text of a revision.
The identification makes it simple to determine which
revisions of which modules make up a given configuration.
.IP \(bu
Minimize secondary storage.  \*r needs little extra space for
the revisions (only the differences).  If intermediate revisions are
deleted, the corresponding deltas are compressed accordingly.
.SS "Getting Started with \*r"
Suppose you have a file
.B f.c
that you wish to put under control of \*r.
If you have not already done so, make an \*r directory with the command
.IP
.B "mkdir  RCS"
.LP
Then invoke the check-in command
.IP
.B "ci  f.c"
.LP
This command creates an \*r file in the
.B RCS
directory,
stores
.B f.c
into it as revision 1.1, and
deletes
.BR f.c .
It also asks you for a description.  The description
should be a synopsis of the contents of the file.  All later check-in
commands will ask you for a log entry, which should summarize the
changes that you made.
.PP
Files in the \*r directory are called \*r files;
the others are called working files.
To get back the working file
.B f.c
in the previous example, use the check-out
command
.IP
.B "co  f.c"
.LP
This command extracts the latest revision from the \*r file
and writes
it into
.BR f.c .
If you want to edit
.BR f.c ,
you must lock it as you check it out with the command
.IP
.B "co  \-l  f.c"
.LP
You can now edit
.BR f.c .
.PP
Suppose after some editing you want to know what changes that you have made.
The command
.IP
.B "rcsdiff  f.c"
.LP
tells you the difference between the most recently checked-in version
and the working file.
You can check the file back in by invoking
.IP
.B "ci  f.c"
.LP
This increments the revision number properly.
.PP
If
.B ci
complains with the message
.IP
.BI "ci error: no lock set by " "your name"
.LP
then you have tried to check in a file even though you did not
lock it when you checked it out.
Of course, it is too late now to do the check-out with locking, because
another check-out would
overwrite your modifications.  Instead, invoke
.IP
.B "rcs  \-l  f.c"
.LP
This command will lock the latest revision for you, unless somebody
else got ahead of you already.  In this case, you'll have to negotiate with
that person.
.PP
Locking assures that you, and only you, can check in the next update, and
avoids nasty problems if several people work on the same file.
Even if a revision is locked, it can still be checked out for
reading, compiling, etc.  All that locking
prevents is a
.I "check-in"
by anybody but the locker.
.PP
If your \*r file is private, i.e., if you are the only person who is going
to deposit revisions into it, strict locking is not needed and you
can turn it off.
If strict locking is turned off,
the owner of the \*r file need not have a lock for check-in; all others
still do.  Turning strict locking off and on is done with the commands
.IP
.BR "rcs  \-U  f.c" "     and     " "rcs  \-L  f.c"
.LP
If you don't want to clutter your working directory with \*r files, create
a subdirectory called
.B RCS
in your working directory, and move all your \*r
files there.  \*r commands will look first into that directory to find
needed files.  All the commands discussed above will still work, without any
modification.
(Actually, pairs of \*r and working files can be specified in three ways:
(a) both are given, (b) only the working file is given, (c) only the
\*r file is given.  Both \*r and working files may have arbitrary path prefixes;
\*r commands pair them up intelligently.)
.PP
To avoid the deletion of the working file during check-in (in case you want to
continue editing or compiling), invoke
.IP
.BR "ci  \-l  f.c" "     or     " "ci  \-u  f.c"
.LP
These commands check in
.B f.c
as usual, but perform an implicit
check-out.  The first form also locks the checked in revision, the second one
doesn't.  Thus, these options save you one check-out operation.
The first form is useful if you want to continue editing,
the second one if you just want to read the file.
Both update the identification markers in your working file (see below).
.PP
You can give
.B ci
the number you want assigned to a checked in
revision.  Assume all your revisions were numbered 1.1, 1.2, 1.3, etc.,
and you would like to start release 2.
The command
.IP
.BR "ci  \-r2  f.c" "     or     " "ci  \-r2.1  f.c"
.LP
assigns the number 2.1 to the new revision.
From then on,
.B ci
will number the subsequent revisions
with 2.2, 2.3, etc.  The corresponding
.B co
commands
.IP
.BR "co  \-r2  f.c" "     and     " "co  \-r2.1  f.c"
.PP
retrieve the latest revision numbered
.RI 2. x
and the revision 2.1,
respectively.
.B co
without a revision number selects
the latest revision on the
.IR trunk ,
i.e. the highest
revision with a number consisting of two fields.  Numbers with more than two
fields are needed for branches.
For example, to start a branch at revision 1.3, invoke
.IP
.B "ci  \-r1.3.1  f.c"
.LP
This command starts a branch numbered 1 at revision 1.3, and assigns
the number 1.3.1.1 to the new revision.  For more information about
branches, see
.BR rcsfile (5).
.SS "Automatic Identification"
\*r can put special strings for identification into your source and object
code.  To obtain such identification, place the marker
.IP
.B "$\&Id$"
.LP
into your text, for instance inside a comment.
\*r will replace this marker with a string of the form
.IP
.BI $\&Id: "  filename  revision  date  time  author  state  " $
.LP
With such a marker on the first page of each module, you can
always see with which revision you are working.
\*r keeps the markers up to date automatically.
To propagate the markers into your object code, simply put
them into literal character strings.  In C, this is done as follows:
.IP
.ft 3
static char rcsid[] = \&"$\&Id$\&";
.ft
.LP
The command
.B ident
extracts such markers from any file, even object code
and dumps.
Thus,
.B ident
lets you find out
which revisions of which modules were used in a given program.
.PP
You may also find it useful to put the marker
.B $\&Log$
into your text, inside a comment.  This marker accumulates
the log messages that are requested during check-in.
Thus, you can maintain the complete history of your file directly inside it.
There are several additional identification markers; see
.BR co (1)
for
details.
.SH IDENTIFICATION
Author: Walter F. Tichy.
.br
Manual Page Revision: \*(Rv; Release Date: \*(Dt.
.br
Copyright \(co 1982, 1988, 1989 Walter F. Tichy.
.br
Copyright \(co 1990, 1991, 1992, 1993 Paul Eggert.
.SH "SEE ALSO"
ci(1), co(1), ident(1), rcs(1), rcsdiff(1), rcsintro(1), rcsmerge(1), rlog(1)
.br
Walter F. Tichy,
\*r\*-A System for Version Control,
.I "Software\*-Practice & Experience"
.BR 15 ,
7 (July 1985), 637-654.
.br