home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 317a.lha / RCS / doc / rcs.ms < prev    next >
Text File  |  1989-12-05  |  56KB  |  1,516 lines

  1. .\    Format this file with:
  2. .\    pic file | tbl | troff -ms 
  3.  
  4. .\ PS and PE center pic diagrams. (The corresponding ms-macros may not.)
  5. .de PS
  6. .nr pE (\\n(.lu-\\$2u)/2u
  7. .in +\\n(pEu
  8. .ne \\$1u
  9. ..
  10. .de PE
  11. .in -\\n(pEu
  12. ..
  13. .de D(
  14. .DS
  15. .nr VS 12pts
  16. .vs 12pts
  17. .I
  18. ..
  19. .de D)
  20. .DE
  21. .nr VS 18pts
  22. .vs 18pts
  23. .R
  24. ..
  25.  
  26. .ND July 1985
  27. .RP
  28. .TL
  29. RCS \- A System for Version Control
  30.  
  31. .AU
  32. Walter F. Tichy
  33. .AI
  34. Department of Computer Sciences
  35. Purdue University
  36. West Lafayette, Indiana 47907
  37.  
  38. .AB
  39. An important problem in program development and maintenance is version control,
  40. i.e., the task of keeping a software system consisting of many versions and
  41. configurations well organized.
  42. The Revision Control System (RCS) 
  43. is a software tool that assists with that task.
  44. RCS manages revisions of text documents, in particular source programs,
  45. documentation, and test data.
  46. It automates the storing, retrieval, logging and identification of revisions,
  47. and it provides selection mechanisms for composing configurations.
  48. This paper introduces basic version control concepts and
  49. discusses the practice of version control
  50. using RCS.
  51. For conserving space, RCS stores deltas, i.e., differences between
  52. successive revisions. Several delta storage methods are discusses.
  53. Usage statistics show that RCS's delta storage method is
  54. space and time efficient.
  55. The paper concludes with a detailed survey of version control tools.
  56.  
  57. \fBKeywords\fR: configuration management, history management,
  58. version control, revisions, deltas.
  59. .AE
  60. .FS
  61. A version of this paper was published in Software--Practice and Experience,
  62. Vol. 15(7), 637-654 (July 1985).
  63. .FE
  64. .nr VS 18pts
  65. .EQ
  66. delim $$
  67. .EN
  68. .LP
  69. .NH
  70. Introduction
  71. .PP
  72. Version control is the task of keeping software
  73. systems consisting of many versions and configurations well organized.
  74. The Revision Control System (RCS) is a set of UNIX 
  75. commands that assist with that task.
  76. .PP
  77. RCS' primary function is to manage \fIrevision groups\fR.
  78. A revision group is a set of text documents, called \fIrevisions\fR,
  79. that evolved from each other. A new revision is
  80. created by manually editing an existing one.
  81. RCS organizes the revisions into an ancestral tree. The initial revision
  82. is the root of the tree, and the tree edges indicate
  83. from which revision a given one evolved.
  84. Besides managing individual revision groups, RCS provides
  85. flexible selection functions for composing configurations.
  86. RCS may be combined with MAKE\u1\d,
  87. resulting in a powerful package for version control.
  88. .PP
  89. RCS also offers facilities for
  90. merging updates with customer modifications,
  91. for distributed software development, and
  92. for automatic identification.
  93. Identification is the `stamping'
  94. of revisions and configurations with unique markers.
  95. These markers are akin to serial numbers,
  96. telling software maintainers unambiguously which configuration
  97. is before them.
  98. .PP
  99. RCS is designed for both production and experimental
  100. environments.
  101. In production environments,
  102. access controls detect update conflicts and prevent overlapping changes.
  103. In experimental environments, where strong controls are
  104. counterproductive, it is possible to loosen the controls.
  105. .PP
  106. Although RCS was originally intended for programs, it is useful for any
  107. text that is revised frequently and whose previous revisions must be
  108. preserved. RCS has been applied successfully to store the source
  109. text for drawings, VLSI layouts, documentation, specifications,
  110. test data, form letters and articles.
  111. .PP
  112. This paper discusses the practice of
  113. version control using RCS.
  114. It also introduces basic version control concepts,
  115. useful for clarifying current practice and designing similar systems.
  116. Revision groups of individual components are treated in the next three sections
  117.  
  118. and the extensions to configurations follow.
  119. Because of its size, a survey of version control tools
  120. appears at the end of the paper.
  121. .NH
  122. Getting started with RCS
  123. .PP
  124. Suppose a text file \fIf.c\fR is to be placed under control of RCS.
  125. Invoking the check-in command
  126. .D(
  127. ci  f.c
  128. .D)
  129. creates a new revision group with the contents of
  130. \fIf.c\fR as the initial
  131. revision (numbered 1.1)
  132. and stores the group into the file \fIf.c,v\fR.
  133. Unless told otherwise, the command deletes \fIf.c\fR.
  134. It also asks for a description of the group.
  135. The description should state the common purpose of all revisions in the group,
  136. and becomes part of the group's documentation.
  137. All later check-in commands will ask for a log entry,
  138. which should summarize the changes made.
  139. (The first revision is assigned a default log message,
  140. which just records the fact that it is the initial revision.)
  141. .PP
  142. Files ending in \fI,v\fR
  143. are called \fIRCS files\fR (\fIv\fR stands for \fIv\fRersions);
  144. the others are called working files.
  145. To get back the working file \fIf.c\fR in the previous example,
  146. execute the check-out command:
  147. .D(
  148. co  f.c
  149. .D)
  150. .R
  151. This command extracts the latest revision from
  152. the revision group \fIf.c,v\fR and writes
  153. it into \fIf.c\fR.
  154. The file \fIf.c\fR can now be edited and, when finished,
  155. checked back in with \fIci\fR:
  156. .D(
  157. ci  f.c
  158. .D)
  159. \fICi\fR assigns number 1.2 to
  160. the new revision.
  161. If \fIci\fR complains with the message
  162. .D(
  163. ci error: no lock set by <login>
  164. .D)
  165. then the system administrator has decided to configure RCS for a
  166. production environment by enabling the `strict locking feature'.
  167. If this feature is enabled, all RCS files are initialized
  168. such that check-in operations require a lock on the previous revision
  169. (the one from which the current one evolved).
  170. Locking prevents overlapping modifications if several people work on the same f
  171. le.
  172. If locking is required, the revision should
  173. have been locked during the check-out by using
  174. the option \fI-l\fR:
  175. .D(
  176. co  -l  f.c
  177. .D)
  178. Of course it is too late now for the check-out with locking, because
  179. \fIf.c\fR has already been changed; checking out the file again
  180. would overwrite the modifications.
  181. (To prevent accidental overwrites, \fIco\fR senses the presence
  182. of a working file and asks whether the user really intended to overwrite it.
  183. The overwriting check-out is sometimes useful for
  184. backing up to the previous revision.)
  185. To be able to proceed with the check-in in the present case, first execute
  186. .D(
  187. rcs  -l  f.c
  188. .D)
  189. This command retroactively locks the latest revision, unless someone
  190. else locked it in the meantime. In this case, the two programmers
  191. involved have to negotiate whose
  192. modifications should take precedence.
  193. .PP
  194. If an RCS file is private, i.e., if only the owner of the file is expected
  195. to deposit revisions into it, the strict locking feature is unnecessary and
  196. may be disabled.
  197. If strict locking is disabled,
  198. the owner of the RCS file need not have a lock for check-in.
  199. For safety reasons, all others
  200. still do. Turning strict locking off and on is done with the commands:
  201. .D(
  202. rcs  -U  f.c       \fRand\fI         rcs  -L  f.c
  203. .D)
  204. These commands enable or disable the strict locking feature for each RCS file
  205. individually.
  206. The system administrator only decides whether strict locking is
  207. enabled initially.
  208. .PP
  209. To reduce the clutter in a working directory, all RCS files can be moved
  210. to a subdirectory with the name \fIRCS\fR.
  211. RCS commands look first into that directory for RCS files.
  212. All the commands presented above work
  213. with the \fIRCS\fR subdirectory without change.\(dg
  214. .FS
  215. \(dg Pairs of RCS and working files can actually be specified in 3 ways:
  216. a) both are given, b) only the working file is given, c) only the
  217. RCS file is given.
  218. If a pair is given, both files may have arbitrary path prefixes;
  219. RCS commands pair them up intelligently.
  220. .FE
  221. .PP
  222. It may be undesirable that \fIci\fR deletes the working file.
  223. For instance, sometimes one would like to save the current revision,
  224. but continue editing.
  225. Invoking
  226. .D(
  227. ci  -l  f.c
  228. .D)
  229. checks in \fIf.c\fR as usual, but performs an additional
  230. check-out with locking afterwards. Thus, the working file does
  231. not disappear after the check-in.
  232. Similarly, the option
  233. \fI-u\fR does a check-in followed by a check-out without
  234. locking. This option is useful if the file is needed for compilation after the 
  235. heck-in.
  236. Both options update the identification markers in the working file
  237. (see below).
  238. .PP
  239. Besides the operations \fIci\fR and \fIco\fR, RCS provides the following
  240. commands:
  241. \fIident\fR (extract identification markers),
  242. \fIrcs\fR (change RCS file attributes),
  243. \fIrcsclean\fR (remove unchanged working files),
  244. \fIrcsdiff\fR (compare revisions),
  245. \fIrcsfreeze\fR (record a configuration),
  246. \fIrcsmerge\fR (merge revisions),
  247. and \fIrlog\fR (read log messages and other information in RCS files).
  248. A synopsis of these commands appears in the Appendix.
  249. .NH 2
  250. Automatic Identification
  251. .PP
  252. RCS can stamp source and object code with special identification strings,
  253. similar to product and serial numbers.
  254. To obtain such identification, place the marker
  255. .D(
  256. $Header$
  257. .D)
  258. into the text of a revision, for instance inside a comment.
  259. The check-out operation will replace this marker with a string of the form
  260. .D(
  261. $Header:  filename  revisionnumber  date  time  author  state  locker $
  262. .D)
  263. This string need never be touched, because \fIco\fR keeps it
  264. up to date automatically.
  265. To propagate the marker into object code, simply put
  266. it into a literal character string. In C, this is done as follows:
  267. .D(
  268. static char rcsid[] = "$Header$";
  269. .D)
  270. The command \fIident\fR extracts such markers from any file, in particular from
  271. object code.
  272. \fIIdent\fR helps to find out
  273. which revisions of which modules were used in a given program.
  274. It returns a complete and unambiguous component list,
  275. from which a copy of the program can be reconstructed.
  276. This facility is invaluable for program maintenance.
  277. .PP
  278. There are several additional identification markers, one for each component
  279. of $Header$.
  280. The marker
  281. .D(
  282. $Log$
  283. .D)
  284. has a similar function. It accumulates
  285. the log messages that are requested during check-in.
  286. Thus, one can maintain the complete history of a revision directly inside it,
  287. by enclosing it in a comment.
  288. Figure 1 is a partial reproduction of a log contained in revision 4.1 of
  289. the file \fIci.c\fR. The log appears at the beginning of the file,
  290. and makes it easy to determine what the recent modifications were.
  291. .sp
  292. .nr VS 12pts
  293. .vs 12pts
  294. .ne 18
  295. .nf
  296. .in +0.5i
  297. /* $Log:        ci.c,v $
  298.  * Revision 4.1  83/05/10  17:03:06  wft
  299.  * Added option -d and -w, and updated assignment of date, etc. to new delta.
  300.  * Added handling of default branches.
  301.  * 
  302.  * Revision 3.9  83/02/15  15:25:44  wft
  303.  * Added call to fastcopy() to copy remainder of RCS file.
  304.  *
  305.  * Revision 3.8  83/01/14  15:34:05  wft
  306.  * Added ignoring of interrupts while new RCS file is renamed;
  307.  * avoids deletion of RCS files by interrupts.
  308.  *
  309.  * Revision 3.7  82/12/10  16:09:20  wft
  310.  * Corrected checking of return code from diff.
  311.  * An RCS file now inherits its mode during the first ci from the working file,
  312.  * except that write permission is removed.
  313.  */
  314. .in 0
  315. .ce 1
  316. Figure 1. Log entries produced by the marker $Log$.
  317. .fi
  318. .nr VS 18pts
  319. .vs 18pts
  320. .sp 0
  321. .LP
  322. Since revisions are stored in the form of differences,
  323. each log message is
  324. physically stored once,
  325. independent of the number of revisions present.
  326. Thus, the $Log$ marker incurs negligible space overhead.
  327. .NH
  328. The RCS Revision Tree
  329. .PP
  330. RCS arranges revisions in an ancestral tree.
  331. The \fIci\fR command builds this tree; the auxiliary command \fIrcs\fR
  332. prunes it.
  333. The tree has a root revision, normally numbered 1.1, and successive revisions
  334. are numbered 1.2, 1.3, etc. The first field of a revision number
  335. is called the \fIrelease number\fR and the second one
  336. the \fIlevel number\fR. Unless given explicitly,
  337. the \fIci\fR command assigns a new revision number
  338. by incrementing the level number of the previous revision.
  339. The release number must be incremented explicitly, using the
  340. \fI-r\fR option of \fIci\fR.
  341. Assuming there are revisions 1.1, 1.2, and 1.3 in the RCS file f.c,v, the comma
  342. d
  343. .D(
  344. ci  -r2.1  f.c       \fRor\fI       ci  -r2  f.c
  345. .D)
  346. assigns the number 2.1 to the new revision.
  347. Later check-ins without the \fI-r\fR option will assign the numbers 2.2, 2.3,
  348. and so on.
  349. The release number should be incremented only at major transition points
  350. in the development, for instance when a new release of a software product has
  351. been completed.
  352. .NH 2
  353. When are branches needed?
  354. .PP
  355. A young revision tree is slender:
  356. It consists of only one branch, called the trunk.
  357. As the tree ages, side branches may form.
  358. Branches are needed in the following 4 situations.
  359. .IP "\fITemporary fixes\fR"
  360. .sp 0
  361. Suppose a tree has 5 revisions grouped in 2 releases,
  362. as illustrated in Figure 2.
  363. Revision 1.3, the last one of release 1, is in operation at customer sites,
  364. while release 2 is in active development.
  365. .ne 4
  366. .PS 4i
  367. .ps -2
  368. box "1.1"
  369. arrow
  370. box "1.2"
  371. arrow
  372. box "1.3"
  373. arrow
  374. box "2.1"
  375. arrow
  376. box "2.2"
  377. arrow dashed
  378. .ps +2
  379. .PE
  380. .ce 1
  381. Figure 2. A slender revision tree.
  382. .sp 0
  383. Now imagine a customer requesting a fix of
  384. a problem in revision 1.3, although actual development has moved on
  385. to release 2. RCS does not permit an extra
  386. revision to be spliced in between 1.3 and 2.1, since that would not reflect
  387. the actual development history. Instead, create a branch
  388. at revision 1.3, and check in the fix on that branch.
  389. The first branch starting at 1.3 has number 1.3.1, and
  390. the revisions on that branch are numbered 1.3.1.1, 1.3.1.2, etc.
  391. The double numbering is needed to allow for another
  392. branch at 1.3, say 1.3.2.
  393. Revisions on the second branch would be numbered
  394. 1.3.2.1, 1.3.2.2, and so on.
  395. The following steps create
  396. branch 1.3.1 and add revision 1.3.1.1:
  397. .sp 0
  398. .I
  399. .nr VS 12pts
  400. .vs 12pts
  401. .TS
  402. tab(%);
  403. l l l.
  404.      %co  -r1.3  f.c         % -- check out revision 1.3
  405.      %edit  f.c              % -- change it
  406.      %ci  -r1.3.1  f.c       % -- check it in on branch 1.3.1
  407. .TE
  408. .nr VS 18pts
  409. .vs 18pts
  410. .R
  411. This sequence of commands transforms the tree of Figure 2 into
  412. the one in Figure 3.
  413. Note that it may be necessary to incorporate the differences
  414. between 1.3 and 1.3.1.1
  415. into a revision at level 2. The operation \fIrcsmerge\fR automates this
  416. process (see the Appendix).
  417. .ne 7
  418. .PS  4i
  419. .ps -2
  420.      box "1.1"
  421.      arrow
  422.      box "1.2"
  423.      arrow
  424. R13: box "1.3"
  425.      arrow
  426. R21: box "2.1"
  427.      arrow
  428. R22: box "2.2"
  429.      arrow dashed
  430.      line invis down from R21.s
  431. RB1: box "1.3.1.1"
  432.      arrow dashed right from RB1.e
  433.      arrow from R13.s to RB1.w
  434. .ps +2
  435. .PE
  436. .ce 1
  437. Figure 3. A revision tree with one side branch
  438.  
  439. .IP "\fIDistributed development and customer modifications\fR"
  440. .sp 0
  441. Assume a situation as in Figure 2, where revision 1.3 is in operation
  442. at several customer sites,
  443. while release 2 is in development.
  444. Customer sites should use RCS to store the distributed software.
  445. However, customer modifications should not be placed on the same branch
  446. as the distributed source; instead, they should be placed on a side branch.
  447. When the next software distribution arrives,
  448. it should be appended to the trunk of
  449. the customer's RCS file, and the customer
  450. can then merge the local modifications back into the new release.
  451. In the above example, a
  452. customer's RCS file would contain the following tree, assuming
  453. that the customer has received revision 1.3, added his local modifications
  454. as revision 1.3.1.1, then received revision 2.4, and merged
  455. 2.4 and 1.3.1.1, resulting in 2.4.1.1.
  456. .ne 7
  457. .PS  4i
  458. .ps -2
  459. R13: box "1.3"
  460.      line invis
  461. R21: box invis
  462.      line invis
  463. R22: box invis
  464.      line invis
  465. R24: box "2.4"
  466.      line invis
  467. R25: box invis
  468.      line invis
  469.      arrow from R13.e to R24.w
  470.      line invis down from R21.s
  471. RB1: box "1.3.1.1"
  472.      arrow from R13.s to RB1.w
  473.      right
  474.      line invis down from R25.s
  475. RB2: box "2.4.1.1"
  476.      arrow from R24.s to RB2.w
  477. .ps +2
  478. .PE
  479. .ce 1
  480. Figure 4. A customer's revision tree with local modifications.
  481. .sp 1
  482. This approach is actually practiced in the CSNET project,
  483. where several universities and a company cooperate
  484. in developing a national computer network.
  485. .IP "\fIParallel development\fR"
  486. .sp 0
  487. Sometimes it is desirable to explore an alternate design or
  488. a different implementation technique in parallel with the
  489. main line development. Such development
  490. should be carried out on a side branch.
  491. The experimental changes may later be moved into the main line, or abandoned.
  492. .IP "\fIConflicting updates\fR"
  493. .sp 0
  494. A common occurrence is that one programmer
  495. has checked out a revision, but cannot complete the assignment
  496. for some reason. In the meantime, another person
  497. must perform another modification
  498. immediately. In that case, the second person should check-out the same revision
  499.  
  500. modify it, and check it in on a side branch, for later merging.
  501. .PP
  502. Every node in a revision tree consists of the following attributes:
  503. a revision number, a check-in date and time, the author's identification,
  504. a log entry, a state and the actual text. All these attributes
  505. are determined at the time the revision is checked in.
  506. The state attribute indicates the status of a revision.
  507. It is set automatically to `experimental' during check-in.
  508. A revision can later be promoted to a higher status, for example
  509. `stable' or `released'. The set of states is user-defined.
  510. .NH 2
  511. Revisions are represented as deltas
  512. .PP
  513. For conserving space, RCS stores revisions in the form
  514. of deltas, i.e., as differences between revisions.
  515. The user interface completely hides this fact.
  516. .PP
  517. A delta is a sequence of edit commands that transforms one string
  518. into another. The deltas employed by RCS are line-based, which means
  519. that the only edit commands allowed are insertion and deletion of lines.
  520. If a single character in a line is changed, the
  521. edit scripts consider the entire line changed.
  522. The program \fIdiff\fR\u2\d
  523. produces a small, line-based delta between pairs of text files.
  524. A character-based edit script would take much longer to compute,
  525. and would not be significantly shorter.
  526. .PP
  527. Using deltas is a classical space-time tradeoff: deltas reduce the
  528. space consumed, but increase access time.
  529. However, a version control tool should impose as little delay
  530. as possible on programmers.
  531. Excessive delays discourage the use of version controls,
  532. or induce programmers to take shortcuts that compromise system integrity.
  533. To gain reasonably fast access time for both editing and compiling,
  534. RCS arranges deltas in the following way.
  535. The most recent revision on the trunk is stored intact.
  536. All other revisions on the trunk are stored as reverse deltas.
  537. A reverse delta describes how to go backward in the development history:
  538. it produces the desired revision if applied to the successor of that revision.
  539. This implementation has the advantage
  540. that extraction of the latest revision is a simple and fast copy
  541. operation.
  542. Adding a new revision to the trunk is also fast: \fIci\fR simply
  543. adds the new revision intact, replaces the previous
  544. revision with a reverse delta, and keeps the rest of the old deltas.
  545. Thus, \fIci\fR requires the computation
  546. of only one new delta.
  547. .PP
  548. Branches need special treatment. The naive solution would be to
  549. store complete copies for the tips of all branches.
  550. Clearly, this approach would cost too much space. Instead,
  551. RCS uses \fIforward\fR deltas for branches. Regenerating a revision
  552. on a side branch proceeds as follows. First, extract the latest revision
  553. on the trunk; secondly, apply reverse deltas until the fork revision for
  554. the branch is obtained; thirdly, apply forward deltas until the desired
  555. branch revision is reached. Figure 5 illustrates a tree with
  556. one side branch. Triangles pointing to the left and right represent
  557. reverse and forward deltas, respectively.
  558. .ne 8
  559. .PS  4i
  560. .ps -2
  561. define BD X [line invis $1 right .5;
  562. line up .3 then left .5 down .3 then right .5 down .3 then up .3] X
  563.  
  564. define FD X [line invis $1 right .5;
  565. line left .5 down .3 then up .6 then right .5 down .3;] X
  566.  
  567. right
  568. D11:    BD(" 1.1")
  569.     arrow right from D11.e
  570. D12:    BD(" 1.2")
  571.     arrow  right from D12.e
  572. D13:    BD(" 1.3")
  573.     arrow  right from D13.e
  574. D21:    BD(" 2.1")
  575.     arrow  right from D21.e
  576. D22:    box "2.2"
  577.     line invis down from D21.s
  578. F1:     FD("1.3.1.1 ")
  579.     arrow from D13.se to F1.w
  580.     arrow from F1.e right
  581.     right
  582. F2:     FD("1.3.1.2 ")
  583. .ps +2
  584. .PE
  585. .ce 1
  586. Figure 5. A revision tree with reverse and forward deltas.
  587. .sp 0
  588. .PP
  589. Although implementing fast check-out for the latest trunk revision, 
  590. this arrangement has the disadvantage that generation of other revisions 
  591. takes time proportional to the number of deltas applied. For example, 
  592. regenerating the branch tip in Figure 5 requires application of five 
  593. deltas (including the initial one). Since usage statistics show that
  594. the latest trunk revision is the one that is retrieved in 95 per cent 
  595. of all cases (see the section on usage statistics), biasing check-out time 
  596. in favor of that revision results in significant savings.
  597. However, careful implementation of the delta application process is
  598. necessary to provide low retrieval overhead for other revisions, in
  599. particular for branch tips.
  600. .PP
  601. There are several techniques for delta application.
  602. The naive one is to pass each delta to a general-purpose text editor.
  603. A prototype of RCS invoked the UNIX editor \fIed\fR both
  604. for applying deltas and for expanding the identification markers.
  605. Although easy to implement, performance was poor, owing to the 
  606. high start-up costs and excess generality of \fIed\fR. An intermediate
  607. version of RCS used a special-purpose, stream-oriented editor.
  608. This technique reduced the cost of applying a delta to the cost of
  609. checking out the latest trunk revision. The reason for this behavior
  610. is that each delta application involves a complete pass over
  611. the preceding revision.
  612. .PP
  613. However, there is a much better algorithm. Note that the deltas are
  614. line oriented and that most of the work of a stream editor involves
  615. copying unchanged lines from one revision to the next. A faster
  616. algorithm avoids unnecessary copying of character strings by using
  617. a \fIpiece table\fR. 
  618. A piece table is a one-dimensional array, specifying how a given
  619. revision is `pieced together' from lines in the RCS file.
  620. Suppose piece table \fIPT\dr\u\fR represents revision \fIr\fR.
  621. Then \fIPT\dr\u[i]\fR contains the starting position of line \fIi\fR
  622. of revision \fIr\fR.
  623. Application of the next delta transforms piece table \fIPT\dr\u\fR
  624. into \fIPT\dr+1\u\fR. For instance, a delete command removes a
  625. series of entries from the piece table. An insertion command inserts
  626. new entries, moving the entries following the insertion point further down the
  627. array. The inserted entries point to the text lines in the delta.
  628. Thus, no I/O is involved except for reading the delta itself. When all
  629. deltas have been applied to the piece table, a sequential pass
  630. through the table looks up each line in the RCS file and copies it to
  631. the output file, updating identification markers at the same time.
  632. Of course, the RCS file must permit random access, since the copied
  633. lines are scattered throughout that file. Figure 6 illustrates an
  634. RCS file with two revisions and the corresponding piece tables.
  635. .ne 13
  636. .sp 12
  637. .ce 1
  638. Figure 6. An RCS file and its piece tables
  639. .sp 0
  640. .PP
  641. The piece table approach has the property that the time for applying a single
  642. delta is roughly determined by the size of the delta, and not by the
  643. size of the revision. For example, if a delta is 
  644. 10 per cent of the size of a revision, then applying it takes only 
  645. 10 per cent of the time to generate the latest trunk revision. (The stream
  646. editor would take 100 per cent.)
  647. .PP
  648. There is an important alternative for representing deltas that affects
  649. performance. SCCS\u3\d,
  650. a precursor of RCS, uses \fIinterleaved\fR deltas.
  651. A file containing interleaved deltas is partitioned into blocks of lines.
  652. Each block has a header that specifies to which revision(s) the block
  653. belongs. The blocks are sorted out in such a way that a single
  654. pass over the file can pick up all the lines belonging to a given
  655. revision. Thus, the regeneration time for all revisions is the same:
  656. all headers must be inspected, and the associated blocks either copied
  657. or skipped. As the number of revisions increases, the cost of retrieving
  658. any revision is much higher than the cost of checking out the 
  659. latest trunk revision with reverse deltas. A detailed comparison
  660. of SCCS's interleaved deltas and RCS's reverse deltas can be found
  661. in Reference 4.
  662. This reference considers the version of RCS with the
  663. stream editor only. The piece table method improves performance
  664. further, so that RCS is always faster than SCCS, except if 10
  665. or more deltas are applied.
  666. .PP
  667. Additional speed-up for both delta methods can be obtained by caching
  668. the most recently generated revision, as has been implemented in DSEE.\u5\d
  669. With caching, access time to frequently used revisions can approach normal file
  670. access time, at the cost of some additional space.
  671. .NH
  672. Locking: A Controversial Issue
  673. .PP
  674. The locking mechanism for RCS was difficult to design.
  675. The problem and its solution are first presented in their `pure' form,
  676. followed by a discussion of the complications
  677. caused by `real-world' considerations.
  678. .PP
  679. RCS must prevent two or more persons from depositing competing changes of the
  680. same revision.
  681. Suppose two programmers check out revision 2.4 and
  682. modify it. Programmer A checks in a revision before programmer B.
  683. Unfortunately, programmer B has not seen A's
  684. changes, so the effect is that A's changes are covered up by B's deposit.
  685. A's changes are not lost since all revisions
  686. are saved, but they are confined to a single revision\(dd.
  687. .FS
  688. \(dd Note that this problem is entirely different from the atomicity problem.
  689. Atomicity means that
  690. concurrent update operations on the same RCS file cannot be permitted,
  691. because that may result in inconsistent data.
  692. Atomic updates are essential (and implemented in RCS),
  693. but do not solve the conflict discussed here.
  694. .FE
  695. .PP
  696. This conflict is prevented in RCS by locking.
  697. Whenever someone intends to edit a revision (as opposed
  698. to reading or compiling it), the revision should be checked out
  699. and locked,
  700. using the \fI-l\fR option on \fIco\fR. On subsequent check-in,
  701. \fIci\fR tests the lock and then removes it.
  702. At most one programmer at a time may
  703. lock a particular revision, and only this programmer may check in
  704. the succeeding revision.
  705. Thus, while a revision is locked, it is the exclusive responsibility
  706. of the locker.
  707. .PP
  708. An important maxim for software tools like RCS is that they must
  709. not stand in the way of making progress with a project.
  710. This consideration leads to several weakenings of the locking mechanism.
  711. First of all, even if a revision is locked, it can
  712. still be checked out. This is necessary if other people
  713. wish to compile or inspect the locked revision
  714. while the next one is in preparation. The only operations they
  715. cannot do are to lock the revision or to check in the succeeding one. Secondly,
  716. check-in operations on other branches in the RCS file are still possible; the
  717. locking of one revision does not affect any other revision.
  718. Thirdly, revisions are occasionally locked for a long period of time
  719. because a programmer is absent or otherwise unable to complete
  720. the assignment. If another programmer has to make a pressing change,
  721. there are the following three alternatives for making progress:
  722. a) find out who is holding the lock and ask that person to release it;
  723. b) check out the locked revision, modify it, check it
  724. in on a branch, and merge the changes later;
  725. c) break the lock. Breaking a lock leaves a highly visible
  726. trace, namely an electronic mail message that is sent automatically to the
  727. holder of the lock, recording the breaker and a commentary requested from him.
  728. Thus, breaking locks is tolerated under certain circumstances,
  729. but will not go unnoticed.
  730. Experience has shown that the automatic mail message attaches a high enough
  731. stigma to lock breaking,
  732. such that programmers break locks only in real emergencies,
  733. or when a co-worker resigns and leaves locked revisions behind.
  734. .PP
  735. If an RCS file is private, i.e., when a programmer owns an RCS file
  736. and does not expect anyone else to perform check-in operations,
  737. locking is an unnecessary nuisance.
  738. In this case,
  739. the `strict locking feature' discussed earlier may be disabled,
  740. provided that file protection
  741. is set such that only the owner may write the RCS file.
  742. This has the effect that only the owner can check-in revisions,
  743. and that no lock is needed for doing so.
  744. .PP
  745. As added protection,
  746. each RCS file contains an access list that specifies the users
  747. who may execute update operations. If an access list is empty,
  748. only normal UNIX file protection applies. Thus, the access list is
  749. useful for restricting the set of people who would otherwise have update
  750. permission. Just as with locking, the access list
  751. has no effect on read-only operations such as \fIco\fR. This approach
  752. is consistent with the UNIX philosophy of openness, which contributes
  753. to a productive software development environment.
  754. .NH
  755. Configuration Management
  756. .PP
  757. The preceding sections described how RCS deals with revisions of individual
  758. components; this section discusses how to handle configurations.
  759. A configuration is a set of revisions, where each revision comes
  760. from a different revision group, and the revisions are selected
  761. according to a certain criterion.
  762. For example,
  763. in order to build a functioning compiler, the `right'
  764. revisions from the scanner, the parser, the optimizer
  765. and the code generator must be combined.
  766. RCS, in conjunction with MAKE,
  767. provides a number of facilities to effect a smooth selection.
  768. .NH 2
  769. RCS Selection Functions
  770. .PP
  771. .IP "\fIDefault selection\fR"
  772. .sp 0
  773. During development, the usual selection criterion is to choose
  774. the latest revision of all components. The \fIco\fR command
  775. makes this selection by default. For example, the command
  776. .D(
  777. co  *,v
  778. .D)
  779. retrieves the latest revision on the default branch of each RCS file
  780. in the current directory.
  781. The default branch is usually the trunk, but may be
  782. set to be a side branch.
  783. Side branches as defaults are needed in distributed software development,
  784. as discussed in the section on the RCS revision tree.
  785.  
  786. .IP "\fIRelease based selection\fR"
  787. .sp 0
  788. Specifying a release or branch number selects the latest revision in
  789. that release or branch.
  790. For instance,
  791. .D(
  792. co  -r2  *,v
  793. .D)
  794. retrieves the latest revision with release number 2 from each RCS file.
  795. This selection is convenient if a release has been completed and
  796. development has moved on to the next release.
  797.  
  798. .IP "\fIState and author based selection\fR"
  799. .sp 0
  800. If the highest level number within a given release number 
  801. is not the desired one,
  802. the state attribute can help. For example,
  803. .D(
  804. co  -r2  -sReleased  *,v
  805. .D)
  806. retrieves the latest revision with release number 2 whose state attribute
  807. is `Released'.
  808. Of course, the state attribute has to be set appropriately, using the
  809. \fIci\fR or \fIrcs\fR commands.
  810. Another alternative is to select a revision by its author,
  811. using the \fI-w\fR option.
  812.  
  813. .IP "\fIDate based selection\fR"
  814. .sp 0
  815. Revisions may also be selected by date.
  816. Suppose a release of an entire system was
  817. completed and current on March 4, at 1:00 p.m. Then the command
  818. .D(
  819. co  -d"March 4, 1:00 pm"  *,v
  820. .D)
  821. checks out all the components of that release, independent of the numbering.
  822. The \fI-d\fR option specifies a `cutoff date', i.e.,
  823. the revision selected has a check-in date that
  824. is closest to, but not after the date given.
  825. 208z
  826. .IP "\fIName based selection\fR"
  827. .sp 0
  828. The most powerful selection function is based on assigning symbolic
  829. names to revisions and branches.
  830. In large systems, a single release number or date is not sufficient
  831. to collect the appropriate revisions from all groups.
  832. For example, suppose one wishes to combine release 2
  833. of one subsystem and release 15 of another.
  834. Most likely, the creation dates of those releases differ also.
  835. Thus, a single revision number or date passed to the \fIco\fR command
  836. will not suffice to select the right revisions.
  837. Symbolic revision numbers solve this problem.
  838. Each RCS file may contain a set of symbolic names that are mapped
  839. to numeric revision numbers. For example, assume
  840. the symbol \fIV3\fR is bound to release number 2 in file \fIs,v\fR, and to
  841. revision number 15.9 in \fIt,v\fR.
  842. Then the single command
  843. .D(
  844. co  -rV3  s,v  t,v
  845. .D)
  846. retrieves the latest revision of release 2 from \fIs,v\fR,
  847. and revision 15.9 from \fIt,v\fR.
  848. In a large system with many modules, checking out all
  849. revisions with one command greatly simplifies configuration management.
  850. .PP
  851. Judicious use of symbolic revision numbers helps with organizing
  852. large configurations.
  853. A special command, \fIrcsfreeze\fR,
  854. assigns a symbolic revision number to a selected revision
  855. in every RCS file.
  856. \fIRcsfreeze\fR effectively freezes a configuration.
  857. The assigned symbolic revision number selects all components
  858. of the configuration.
  859. If necessary, symbolic numbers
  860. may even be intermixed with numeric ones. Thus, \fIV3.5\fR in the
  861. above example
  862. would select revision 2.5 in \fIs,v\fR and branch 15.9.5 in \fIt,v\fR.
  863. .PP
  864. The options \fI-r\fR, \fI-s\fR, \fI-w\fR and \fI-d\fR
  865. may be combined. If a branch is given, the latest revision
  866. on that branch satisfying all conditions is retrieved;
  867. otherwise, the default branch is used.
  868. .NH 2
  869. Combining MAKE and RCS
  870. .PP
  871. MAKE\u1\d
  872. is a program that processes configurations.
  873. It is driven by configuration specifications
  874. recorded in a special file, called a `Makefile'.
  875. MAKE avoids redundant processing steps
  876. by comparing creation dates of source and processed objects.
  877. For example, when instructed to compile all
  878. modules of a given system, it only recompiles
  879. those source modules that were changed
  880. since they were processed last.
  881. .PP
  882. MAKE has been extended with an auto-checkout feature for RCS.
  883. When a certain file to be processed is not present,
  884. MAKE attempts a check-out operation. 
  885. If successful, MAKE performs the required processing, and then deletes
  886. the checked out file to conserve space.
  887. The selection parameters discussed above can be passed to MAKE
  888. either as parameters, or directly embedded in the Makefile.
  889. MAKE has also been extended to search the subdirectory named \fIRCS\fR
  890. for needed files, rather than just the current working directory.
  891. However, if a working file is present, MAKE totally ignores the corresponding
  892. RCS file and uses the working file.
  893. (In newer versions of MAKE distributed by AT&T and others, 
  894. auto-checkout can be
  895. achieved with the rule DEFAULT, instead of a special extension of MAKE.
  896. However, a file checked out by the rule DEFAULT
  897. will not be deleted after processing. \fIRcsclean\fR can be
  898. used for that purpose.)
  899. .PP
  900. With auto-checkout, RCS/MAKE can effect a selection rule
  901. especially tuned for multi-person software development and maintenance.
  902. In these situations,
  903. programmers should obtain configurations that consist of
  904. the revisions they have personally checked out plus the latest
  905. checked in revision of all other revision groups.
  906. This schema can be set up as follows.
  907. .PP
  908. Each programmer chooses a working directory
  909. and places into it a symbolic link, named \fIRCS\fR,
  910. to the directory containing the relevant RCS files.
  911. The symbolic link makes sure that \fIco\fR and \fIci\fR
  912. operations need only specify the working files, and that
  913. the Makefile need not be changed.
  914. The programmer then checks out the needed files and modifies them.
  915. If MAKE is invoked,
  916. it composes configurations by selecting those
  917. revisions that are checked out, and the rest from the
  918. subdirectory \fIRCS\fR.
  919. The latter selection may be controlled by a symbolic
  920. revision number or any of the other selection criteria.
  921. If there are several programmers editing in separate working directories,
  922. they are insulated from each other's changes until checking in their
  923. modifications.
  924. .PP
  925. Similarly, a maintainer can recreate an older configuration
  926. by starting to work in an empty working directory.
  927. During the initial MAKE invocation, all revisions are selected from RCS files.
  928. As the maintainer checks out files and modifies them,
  929. a new configuration is gradually built up.
  930. Every time MAKE is invoked, it substitutes the modified revisions
  931. into the configuration being manipulated.
  932. .PP
  933. A final application of RCS is to use it for storing Makefiles.
  934. Revision groups of Makefiles represent
  935. multiple versions of configurations.
  936. Whenever a configuration is baselined or distributed,
  937. the best approach is to unambiguously fix
  938. the configuration with a symbolic revision number by calling
  939. \fIrcsfreeze\fR,
  940. to embed that symbol into the Makefile, and to
  941. check in the Makefile (using the same symbolic revision number).
  942. With this approach, old configurations
  943. can be regenerated easily and reliably.
  944. .NH
  945. Usage Statistics
  946. .PP
  947. The following usage statistics were collected on two DEC VAX-11/780
  948. computers of the Purdue Computer Science Department. Both machines
  949. are mainly used for research purposes. Thus, the data
  950. reflect an environment in which the majority of projects
  951. involve prototyping and advanced software development,
  952. but relatively little long-term maintenance.
  953. .PP
  954. For the first experiment,
  955. the \fIci\fR and \fIco\fR operations were instrumented
  956. to log the number of backward and forward deltas applied.
  957. The data were collected during a 13 month period
  958. from Dec. 1982 to Dec. 1983.
  959. Table I summarizes the results.
  960. .sp 0
  961. .nr VS 12pts
  962. .vs 12pts
  963. .TS
  964. center,box,tab(#);
  965. c|c|c|c|c s|c s
  966. c|c|c|c|c s|c s
  967. l|n|n|n|n n|n n.
  968. Operation#Total#Total deltas#Mean deltas#Operations#Branch
  969.      #operations #applied#applied#with >1 delta#operations
  970. _
  971. co     # 7867# 9320#1.18#509#(6%)#203#(3%)
  972. ci     # 3468# 2207#0.64# 85#(2%)# 75#(2%)
  973. ci & co#11335#11527#1.02#594#(5%)#278#(2%)
  974. .TE
  975. .ce 1
  976. Table I. Statistics for \fIco\fR and \fIci\fR operations.
  977. .nr VS 18pts
  978. .vs 18pts
  979. .PP
  980. The first two lines show statistics for check-out and check-in;
  981. the third  line shows the combination.
  982. Recall that \fIci\fR performs an implicit check-out to obtain
  983. a revision for computing the delta.
  984. In all measures presented, the most recent revision (stored intact)
  985. counts as one delta. The number of deltas applied represents
  986. the number of passes necessary, where the first `pass' is a copying step.
  987. .PP
  988. Note that the check-out operation is executed more than
  989. twice as frequently as the check-in operation.
  990. The fourth column gives the mean number of deltas
  991. applied in all three cases.
  992. For \fIci\fR, the mean number of deltas applied is less
  993. than one.
  994. The reasons are that the initial check-in requires no delta at all, and that
  995. the only time \fIci\fR requires more than one delta is for branches.
  996. Column 5 shows the actual number of operations that applied more than one
  997. delta.
  998. The last column indicates that branches were not used often.
  999. .PP
  1000. The last three columns demonstrate that the most recent trunk revision
  1001. is by far the most frequently accessed.
  1002. For RCS, check-out of
  1003. this revision is a simple copy operation, which is the absolute minimum
  1004. given the copy-semantics of \fIco\fR.
  1005. Access to older revisions and branches
  1006. is more common in non-academic environments,
  1007. yet even if access to older deltas were an order
  1008. of magnitude more frequent,
  1009. the combined average number of deltas applied would still be below 1.2.
  1010. Since RCS is faster than SCCS until up to 10 delta applications,
  1011. reverse deltas are clearly the method of choice.
  1012. .PP
  1013. The second experiment, conducted in March of 1984,
  1014. involved surveying the existing RCS files
  1015. on our two machines. The goal was to determine the mean number of
  1016. revisions per RCS file, as well as the space consumed by them.
  1017. Table II shows the results. (Tables I and II were produced at different
  1018. times and are unrelated.)
  1019. .sp 0
  1020. .nr VS 12pts
  1021. .vs 12pts
  1022. .TS
  1023. center,box,tab(#);
  1024. c | c | c | c | c | c | c
  1025. c | c | c | c | c | c | c
  1026. l | n | n | n | n | n | n
  1027. .
  1028.       #Total RCS#Total#Mean#Mean size of#Mean size of#Overhead
  1029.       #files#revisions#revisions#RCS files#revisions
  1030. _
  1031. All files #8033#11133#1.39#6156#5585#1.10
  1032. Files with#1477# 4578#3.10#8074#6041#1.34
  1033. \(>= 2 deltas
  1034. .TE
  1035. .ce 1
  1036. Table II. Statistics for RCS files.
  1037. .nr VS 18pts
  1038. .vs 18pts
  1039. .PP
  1040. The mean number of revisions per RCS file is 1.39.
  1041. Columns 5 and 6 show the mean sizes (in bytes) of an RCS file
  1042. and of the latest revision of each RCS file, respectively.
  1043. The `overhead' column contains the ratio of the mean sizes.
  1044. Assuming that all revisions in an RCS file are approximately the same size,
  1045. this ratio gives a measure of the space consumed by the extra revisions.
  1046. .PP
  1047. In our sample, over 80 per cent of the RCS files contained only a single revisi
  1048. n.
  1049. The reason is that our
  1050. systems programmers routinely check in all source files
  1051. on the distribution tapes, even though they may never touch them again.
  1052. To get a better indication of how much space savings are possible
  1053. with deltas, all measures with those files
  1054. that contained 2 or more revisions were recomputed. Only for those files
  1055. is RCS necessary.
  1056. As shown in the second line, the average number of revisions for those files is
  1057. 3.10, with an overhead of 1.34. This means that the extra 2.10 deltas
  1058. require 34 per cent extra space, or
  1059. 16 per cent per extra revision.
  1060. Rochkind\u3\d
  1061. measured the space consumed by SCCS, and
  1062. reported an average of 5 revisions per group
  1063. and an overhead of 1.37 (or about 9 per cent per extra revision).
  1064. In a later paper, Glasser\u6\d
  1065. observed an average of 7 revisions per group in a single, large project,
  1066. but provided no overhead figure.
  1067. In his paper on DSEE\u5\d,
  1068. Leblang reported that delta storage combined with blank compression
  1069. results in an overhead of a mere 1\-2 per cent per revision.
  1070. Since leading blanks accounted for about 20 per cent of the surveyed Pascal
  1071. programs, a revision group with 5\-10 members was smaller
  1072. than a single cleartext copy.
  1073. .PP
  1074. The above observations demonstrate clearly that the space needed
  1075. for extra revisions is small. With delta storage, the luxury of
  1076. keeping multiple revisions online is certainly affordable.
  1077. In fact, introducing a system with delta storage may reduce
  1078. storage requirements, because programmers often save back-up copies
  1079. anyway. Since back-up copies are stored much more efficiently with deltas,
  1080. introducing a system such as RCS may
  1081. actually free a considerable amount of space.
  1082. .NH
  1083. Survey of Version Control Tools
  1084. .PP
  1085. The need to keep back-up copies of software arose when
  1086. programs and data were no longer stored on paper media, but were entered
  1087. from terminals and stored on disk.
  1088. Back-up copies are desirable for reliability, and many modern editors
  1089. automatically save a back-up copy for every file touched.
  1090. This strategy
  1091. is valuable for short-term back-ups, but not suitable for long-term
  1092. version control, since an existing back-up copy is overwritten whenever the
  1093. corresponding file is edited.
  1094. .PP
  1095. Tape archives are suitable for long-term, offline storage.
  1096. If all changed files are dumped on a back-up tape once per day, old revisions
  1097. remain accessible. However, tape archives are unsatisfactory
  1098. for version control in several ways. First, backing up the file
  1099. system every 24 hours does not capture intermediate revisions.
  1100. Secondly, the old revisions are not online,
  1101. and accessing them is tedious and time-consuming.
  1102. In particular, it is impractical to
  1103. compare several old revisions of a group,
  1104. because that may require mounting and searching several tapes.
  1105. Tape archives are important fail-safe tools in the
  1106. event of catastrophic disk failures or accidental deletions,
  1107. but they are ill-suited for version control.
  1108. Conversely, version control tools do not obviate the
  1109. need for tape archives.
  1110. .PP
  1111. A natural technique for keeping several old revisions online is
  1112. to never delete a file.
  1113. Editing a file
  1114. simply creates a new file with the same
  1115. name, but with a different sequence number.
  1116. This technique, available as an option in DEC's VMS operating system,
  1117. turns out to be inadequate for version control.
  1118. First, it is prohibitively expensive in terms of storage costs,
  1119. especially since no data compression techniques are employed.
  1120. Secondly, indiscriminately storing every change produces too many
  1121. revisions, and programmers have difficulties distinguishing them.
  1122. The proliferation of revisions forces programmers to spend much time on
  1123. finding and deleting useless files.
  1124. Thirdly, most of the support functions like locking, logging,
  1125. revision selection,
  1126. and identification described in this paper are not available.
  1127. .PP
  1128. An alternative approach is to separate editing from revision control.
  1129. The user may repeatedly edit a given revision,
  1130. until freezing it with an explicit command.
  1131. Once a revision is frozen, it is stored permanently and can no longer be modifi
  1132. d.
  1133. (In RCS, freezing a revisions is done with \fIci\fR.)
  1134. Editing a frozen revision implicitly creates a new one, which
  1135. can again be changed repeatedly until it is frozen itself.
  1136. This approach saves exactly those revisions that the user
  1137. considers important, and keeps the number of revisions manageable.
  1138. IBM's CLEAR/CASTER\u7\d,
  1139. AT&T's SCCS\u3\d,
  1140. CMU's SDC\u8\d
  1141. and DEC's CMS\u9\d,
  1142. are examples of version control systems using this approach.
  1143. CLEAR/CASTER maintains a data base of programs, specifications,
  1144. documentation and messages, using deltas.
  1145. Its goal is to provide control over the development process from a
  1146. management viewpoint.
  1147. SCCS stores multiple revisions of source text in an ancestral tree,
  1148. records a log entry for each revision,
  1149. provides access control, and has facilities
  1150. for uniquely identifying each revision.
  1151. An efficient delta technique
  1152. reduces the space consumed by each revision group.
  1153. SDC is much simpler than SCCS because it stores not more than
  1154. two revisions. However, it maintains a complete log for all old
  1155. revisions, some of which may be on back-up tape.
  1156. CMS, like SCCS, manages tree-structured revision groups,
  1157. but offers no identification mechanism.
  1158. .PP
  1159. Tools for dealing with configurations are still in a state of flux.
  1160. SCCS, SDC and CMS can be combined with MAKE or MAKE-like programs.
  1161. Since flexible selection rules are missing from all these tools,
  1162. it is sometimes difficult
  1163. to specify precisely which revision of each group
  1164. should be passed to MAKE for building a desired configuration.
  1165. The Xerox Cedar system\u10\d
  1166. provides a `System Modeller' that can rebuild
  1167. a configuration from an arbitrary set of module revisions.
  1168. The revisions of a module are only distinguished by creation time,
  1169. and there is no tool for managing groups.
  1170. Since the selection rules are primitive,
  1171. the System Modeller appears to be somewhat tedious to use.
  1172. Apollo's DSEE\u5\d
  1173. is a sophisticated software engineering environment.
  1174. It manages revision groups in a way similar to SCCS and CMS. Configurations
  1175. are built using `configuration threads'.
  1176. A configuration thread states which revision of each group
  1177. named in a configuration should be chosen.
  1178. A configuration thread may contain dynamic specifiers
  1179. (e.g., `choose the revisions I am currently working on,
  1180. and the most recent revisions otherwise'), which are bound
  1181. automatically at build time.
  1182. It also provides a notification mechanism for alerting
  1183. maintainers about the need to rebuild a system after a change.
  1184. .PP
  1185. RCS is based on a general model for describing
  1186. multi-version/multi-configuration systems\u11\d.
  1187. The model describes systems using AND/OR graphs, where AND nodes represent
  1188. configurations, and OR nodes represent version groups.
  1189. The model gives rise to a suit of selection rules for
  1190. composing configurations, almost all of which are implemented in RCS.
  1191. The revisions selected by RCS are passed to MAKE for configuration building.
  1192. Revision group management is modelled after SCCS.
  1193. RCS retains SCCS's best features,
  1194. but offers a significantly simpler user interface,
  1195. flexible selection rules, adequate integration with MAKE
  1196. and improved identification.
  1197. A detailed comparison of RCS and SCCS appears in Reference 4.
  1198. .PP
  1199. An important component of all revision control systems
  1200. is a program for computing deltas.
  1201. SCCS and RCS use the program \fIdiff\fR\u2\d,
  1202. which first computes the longest common substring of two
  1203. revisions, and then produces the delta from that substring.
  1204. The delta is simply an edit script consisting of deletion and
  1205. insertion commands that generate one revision from the other.
  1206. .PP
  1207. A delta based on a longest common substring is not necessarily minimal,
  1208. because it does not take advantage of crossing block moves.
  1209. Crossing block moves arise if two or more blocks of lines
  1210. (e.g., procedures)
  1211. appear in a different order in two revisions.
  1212. An edit script derived from a longest common substring
  1213. first deletes the shorter of the two blocks, and then reinserts it.
  1214. Heckel\u12\d
  1215. proposed an algorithm for detecting block moves, but
  1216. since the algorithm is based on heuristics,
  1217. there are conditions 
  1218. under which the generated delta is far from minimal.
  1219. DSEE uses this algorithm combined with blank compression,
  1220. apparently with satisfactory overall results.
  1221. A new algorithm that is guaranteed to produce a minimal delta based on
  1222. block moves appears in Reference 13. 
  1223. A future release of RCS will use this algorithm.
  1224. .PP
  1225. \fIAcknowledgements\fR:
  1226. Many people have helped make RCS a success by contributed criticisms, suggestio
  1227. s,
  1228. corrections, and even whole new commands (including manual pages).
  1229. The list of people is too long to be
  1230. reproduced here, but my sincere thanks for their help and
  1231. goodwill goes to all of them.
  1232.  
  1233. .nr VS 12 pts
  1234. .vs 12pts
  1235. .SH
  1236. Appendix: Synopsis of RCS Operations
  1237. .LP
  1238. .IP "\fIci \fB\- check in revisions\fR"
  1239. .sp 0
  1240. \fICi\fR stores the contents of a working file into the
  1241. corresponding RCS file as a new revision.
  1242. If the RCS file doesn't exist, \fIci\fR creates it.
  1243. \fICi\fR removes the working file, unless one of the options
  1244. \fI-u\fR or \fI-l\fR is present.
  1245. For each check-in, \fIci\fR asks for a commentary
  1246. describing the changes relative to the previous revision.
  1247. .sp 1
  1248. \fICi\fR assigns the revision number given by the \fI-r\fR option;
  1249. if that option is missing, it derives the number from the
  1250. lock held by the user; if there is no lock and locking is not strict,
  1251. \fIci\fR increments the number of the latest revision on the trunk.
  1252. A side branch can only be started by explicitly specifying its
  1253. number with the \fI-r\fR option during check-in.
  1254. .sp 1
  1255. \fICi\fR also determines
  1256. whether the revision to be checked in is different from the
  1257. previous one, and asks whether to proceed if not.
  1258. This facility simplifies check-in operations for large systems,
  1259. because one need not remember which files were changed.
  1260. .sp 1
  1261. The option \fI-k\fR searches the checked in file for identification
  1262. markers containing
  1263. the attributes
  1264. revision number, check-in date, author and state, and assigns these
  1265. to the new revision rather than computing them. This option is
  1266. useful for software distribution: Recipients of distributed software
  1267. using RCS should check in updates with the \fI-k\fR option.
  1268. This convention guarantees that revision numbers, check-in dates,
  1269. etc., are the same at all sites.
  1270. .IP "\fIco \fB\- check out revisions\fR"
  1271. .sp 0
  1272. \fICo\fR retrieves revisions according to revision number,
  1273. date, author and state attributes. It either places the revision
  1274. into the working file, or prints it on the std. output.
  1275. \fICo\fR always expands the identification markers.
  1276. .IP "\fIident \fB\- extract identification markers\fR"
  1277. .sp 0
  1278. \fIIdent\fR extracts the identification markers expanded by \fIco\fR
  1279. from any file and prints them.
  1280. .IP "\fIrcs \fB\- change RCS file attributes\fR"
  1281. .sp 0
  1282. \fIRcs\fR is an administrative operation that changes access lists,
  1283. locks, unlocks,  breaks locks, toggles the strict-locking feature,
  1284. sets state attributes and symbolic revision numbers, changes the
  1285. description, and deletes revisions. A revision can
  1286. only be deleted if it is not the fork of a side branch.
  1287. .IP "\fIrcsclean \fB\- clean working directory\fR"
  1288. .sp 0
  1289. \fIRcsclean\fR removes working files that were checked out but never changed.
  1290. .IP "\fIrcsdiff \fB\- compare revisions\fR"
  1291. .sp 0
  1292. \fIRcsdiff\fR compares two revisions and prints their
  1293. difference, using the UNIX tool \fIdiff\fR.
  1294. One of the revisions compared may be checked out.
  1295. This command is useful for finding out about changes.
  1296. .IP "\fIrcsfreeze \fB\- freeze a configuration\fR"
  1297. .sp 0
  1298. \fIRcsfreeze\fR assigns the same symbolic revision number
  1299. to a given revision in all RCS files.
  1300. This command is useful for accurately recording a configuration.
  1301. .IP "\fIrcsmerge \fB\- merge revisions\fR"
  1302. .sp 0
  1303. \fIRcsmerge\fR merges two revisions, \fIrev1\fR and \fIrev2\fR,
  1304. with respect to a common ancestor.
  1305. A 3-way file comparison determines the segments of lines that
  1306. are (a) the same in all three revisions, or (b) the same in 2 revisions,
  1307. or (c) different in all three. For all segments of type (b) where
  1308. \fIrev1\fR is the differing revision,
  1309. the segment in \fIrev1\fR replaces the corresponding segment of \fIrev2\fR.
  1310. Type (c) indicates an overlapping change, is flagged as an error, and requires 
  1311. ser
  1312. intervention to select the correct alternative.
  1313. .IP "\fIrlog \fB\- read log messages\fR"
  1314. .sp 0
  1315. \fIRlog\fR prints the log messages and other information in an RCS file.
  1316. .bp
  1317. .LP
  1318. .nr VS 12 pts
  1319. .vs 12pts
  1320. .]<
  1321. .ds [F 1
  1322. .]-
  1323. .ds [K FELD02
  1324. .ds [K MakeArticle
  1325. .ds [A Feldman, Stuart I.
  1326. .ds [D March 1979
  1327. .ds [T Make - A Program for Maintaining Computer Programs
  1328. .ds [J Software -- Practice and Experience
  1329. .ds [V 9
  1330. .ds [N 3
  1331. .ds [P 255-265
  1332. .nr [P 1
  1333. .nr [T 0
  1334. .nr [A 1
  1335. .nr [O 0
  1336. .][ 1 journal-article
  1337. .ds [F 2
  1338. .]-
  1339. .ds [K HUNT01
  1340. .ds [T An Algorithm for Differential File Comparison
  1341. .ds [A Hunt, James W.
  1342. .as [A " and McIlroy, M. D.
  1343. .ds [I Computing Science Technical Report, Bell Laboratories
  1344. .ds [R 41
  1345. .ds [D June 1976
  1346. .nr [T 0
  1347. .nr [A 1
  1348. .nr [O 0
  1349. .][ 4 tech-report
  1350. .ds [F 3
  1351. .]-
  1352. .ds [K SCCS
  1353. .ds [A Rochkind, Marc J.
  1354. .ds [D Dec. 1975
  1355. .ds [T The Source Code Control System
  1356. .ds [J IEEE Transactions on Software Engineering
  1357. .ds [V SE-1
  1358. .ds [N 4
  1359. .ds [P 364-370
  1360. .nr [P 1
  1361. .nr [T 0
  1362. .nr [A 1
  1363. .nr [O 0
  1364. .][ 1 journal-article
  1365. .ds [F 4
  1366. .]-
  1367. .ds [K TICH08
  1368. .ds [T Design, Implementation, and Evaluation of a Revision Control System
  1369. .ds [A Tichy, Walter F.
  1370. .ds [B Proceedings of the 6th International Conference on Software Engineering
  1371. .ds [I ACM, IEEE, IPS, NBS
  1372. .ds [D September 1982
  1373. .ds [P 58-67
  1374. .nr [P 1
  1375. .nr [T 0
  1376. .nr [A 1
  1377. .nr [O 0
  1378. .][ 3 article-in-book
  1379. .ds [F 5
  1380. .]-
  1381. .ds [K LEBL01
  1382. .ds [A Leblang, David B.
  1383. .as [A " and Chase, Robert P.
  1384. .ds [T Computer-Aided Software Engineering in a Distributed Workstation Environ
  1385. ent
  1386. .ds [O Proceedings of the ACM SIGSOFT/SIGPLAN Software Engineering Symposium
  1387. .as [O " on Practical Software Development Environments.
  1388. .ds [J SIGPLAN Notices
  1389. .ds [V 19
  1390. .ds [N 5
  1391. .ds [D May 1984
  1392. .ds [P 104-112
  1393. .nr [P 1
  1394. .nr [T 0
  1395. .nr [A 1
  1396. .nr [O 0
  1397. .][ 1 journal-article
  1398. .ds [F 1
  1399. .ds [F 3
  1400. .ds [F 6
  1401. .]-
  1402. .ds [K SCCSEval
  1403. .ds [A Glasser, Alan L.
  1404. .ds [D Nov. 1978
  1405. .ds [T The Evolution of a Source Code Control System
  1406. .ds [J Software Engineering Notes
  1407. .ds [V 3
  1408. .ds [N 5
  1409. .ds [P 122-125
  1410. .nr [P 1
  1411. .ds [O Proceedings of the Software Quality and Assurance Workshop.
  1412. .nr [T 0
  1413. .nr [A 1
  1414. .nr [O 1
  1415. .][ 1 journal-article
  1416. .ds [F 5
  1417. .ds [F 7
  1418. .]-
  1419. .ds [K IBMClearCaster
  1420. .ds [A Brown, H.B.
  1421. .ds [D 1970
  1422. .ds [T The Clear/Caster System
  1423. .ds [J Nato Conference on Software Engineering, Rome
  1424. .nr [T 0
  1425. .nr [A 1
  1426. .nr [O 0
  1427. .][ 1 journal-article
  1428. .ds [F 3
  1429. .ds [F 8
  1430. .]-
  1431. .ds [K HabermannSDC
  1432. .ds [A Habermann, A. Nico
  1433. .ds [D Jan. 1979
  1434. .ds [T A Software Development Control System
  1435. .ds [I Technical Report, Carnegie-Mellon University, Department of Computer Sci
  1436. nce
  1437. .nr [T 0
  1438. .nr [A 0
  1439. .nr [O 0
  1440. .][ 2 book
  1441. .ds [F 9
  1442. .]-
  1443. .ds [K CMS
  1444. .ds [A DEC,
  1445. .ds [T Code Management System
  1446. .ds [I Digital Equipment Corporation
  1447. .ds [O Document No. EA-23134-82
  1448. .ds [D 1982
  1449. .nr [T 0
  1450. .nr [A 0
  1451. .nr [O 0
  1452. .][ 2 book
  1453. .ds [F 10
  1454. .]-
  1455. .ds [K LAMP01
  1456. .ds [A Lampson, Butler W.
  1457. .as [A " and Schmidt, Eric E.
  1458. .ds [T Practical Use of a Polymorphic Applicative Language
  1459. .ds [B Proceedings of the 10th Symposium on Principles of Programming Languages
  1460. .ds [I ACM
  1461. .ds [P 237-255
  1462. .nr [P 1
  1463. .ds [D January 1983
  1464. .nr [T 0
  1465. .nr [A 1
  1466. .nr [O 0
  1467. .][ 3 article-in-book
  1468. .ds [F 5
  1469. .ds [F 11
  1470. .]-
  1471. .ds [K TICH07
  1472. .ds [T A Data Model for Programming Support Environments and its Application
  1473. .ds [A Tichy, Walter F.
  1474. .ds [B Automated Tools for Information System Design and Development
  1475. .ds [E Hans-Jochen Schneider and Anthony I. Wasserman
  1476. .ds [C Amsterdam
  1477. .ds [I North-Holland Publishing Company
  1478. .ds [D 1982
  1479. .nr [T 0
  1480. .nr [A 1
  1481. .nr [O 0
  1482. .][ 3 article-in-book
  1483. .ds [F 4
  1484. .ds [F 2
  1485. .ds [F 12
  1486. .]-
  1487. .ds [K HECK01
  1488. .ds [T A Technique for Isolating Differences Between Files
  1489. .ds [A Heckel, Paul
  1490. .ds [J Communications of the ACM
  1491. .ds [D April 1978
  1492. .ds [V 21
  1493. .ds [N 4
  1494. .ds [P 264-268
  1495. .nr [P 1
  1496. .nr [T 0
  1497. .nr [A 0
  1498. .nr [O 0
  1499. .][ 1 journal-article
  1500. .ds [F 13
  1501. .]-
  1502. .ds [K TICH11
  1503. .ds [T The String-to-String Correction Problem with Block Moves
  1504. .ds [A Tichy, Walter F.
  1505. .ds [D Nov. 1984
  1506. .ds [J ACM Transactions on Computer Systems
  1507. .ds [V 2
  1508. .ds [N 4
  1509. .ds [P 309-321
  1510. .nr [P 1
  1511. .nr [T 0
  1512. .nr [A 1
  1513. .nr [O 0
  1514. .][ 1 journal-article
  1515. .]>
  1516.