.\" $Header: rcsintro.1,v 4.4 86/05/21 08:33:51 bob Exp $ .TH RCSINTRO 1 "" " " .SH NAME rcsintro - introduction to RCS commands .SH DESCRIPTION The Revision Control System (RCS) automates the storing, retrieval, logging, identification, and merging of revisions of \fIASCII\fR text files. RCS is useful for managing files that are revised frequently. .sp .PP .B "Functions of RCS" .PP .IP \(bu Storage and retrieval of revisions of text files. RCS saves revisions in a space efficient way. Revisions can be retrieved by ranges of revision numbers, symbolic names, dates, authors, and states. .IP \(bu Maintenance of a complete history of changes. RCS logs all changes automatically. In addition to the text of each revision, RCS stores the author, date and time of check in, and a log message summarizing the change. .IP \(bu Resolution of access conflicts. When two or more people try to modify the same revision of a file, RCS alerts them and prevents one modification from corrupting the other. .IP \(bu Maintenance of a tree of revisions. RCS can maintain separate lines of development for each file. It stores a tree structure that represents the ancestral relationships among revisions. .IP \(bu Merging of revisions and resolution of conflicts. Two separate lines of development of a file can be coalesced by merging. If the revisions to be merged affect the same lines of a file, RCS flags the overlapping changes. .IP \(bu Release and configuration control. Revisions can be assigned symbolic names and marked as released, stable, experimental, etc. With these facilities, configurations of a file can be described simply and directly. .IP \(bu Automatic identification of each revision with file name, revision number, creation time, author, etc. This identification is like a stamp that can be embedded at an appropriate place in the text of a revision. These stamps make it simple to determine which revisions of which files make up a given configuration. .IP \(bu Minimization of secondary storage. RCS uses very little extra space for revisions (only the differences are stored). If intermediate revisions are deleted, the remaining deltas are compressed accordingly. .sp .PP .B "Getting Started with RCS" .PP The basic user interface is extremely simple. The novice only needs to learn two commands: .I ci and .I co. \fICi\fR, short for "check in", deposits the contents of a text file into an archival file called an RCS file. An RCS file contains all revisions of a particular text file. \fICo\fR, short for "check out", retrieves revisions from an RCS file. .PP Suppose you have a file f.c that you wish to put under control of RCS. Invoke the check in command .PP ci f.c .PP .ne 4 This command creates the RCS file f.c,v, stores f.c into it as revision 1.1, and deletes 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 with names ending with `\fB,v\fR' are called RCS files (`v' stands for `versions'), all other files are presumed to be working files. To get back the working file f.c in the previous example, use the check out command .PP co f.c .PP This command extracts the latest revision from f.c,v and writes it into f.c. You can now edit f.c and check it back in by invoking .PP ci f.c .PP \fICi\fR increments the revision number properly. If \fIci\fR complains with the message .PP ci error: no lock set by .PP then your system administrator has decided to create all RCS files with the locking attribute set to `strict'. In this case, you should have locked the revision during the previous check out. Your last check out should have been .PP co -l f.c .PP Of course, it is too late now to do the check out with locking, because you probably modified f.c already, and a second check out would overwrite your modifications. Instead, invoke .PP rcs -l f.c .PP This command will lock the latest revision for you, unless somebody else has already locked it. In that 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 CHECK IN by anybody but the locker. .PP If your RCS 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 RCS file need not have a lock for check in; all others still do. Turning strict locking off and on is done with the commands .PP rcs -U f.c and rcs -L f.c .PP If you don't want to clutter your working directory with RCS files, create a subdirectory called RCS in your working directory, and move all your RCS files there. RCS commands will search that directory to find needed files. All the commands discussed above will still work, without any modification. .PP To avoid the deletion of the working file during check in (in case you want to continue editing), invoke .PP ci -l f.c or ci -u f.c .PP These commands check in 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 locking is strict, the second one if not strict. Both update the identification markers in your working file (see below). .PP You can give \fIci\fR 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 .PP ci -r2 f.c or ci -r2.1 f.c .PP assigns the number 2.1 to the new revision. From then on, \fIci\fR will number the subsequent revisions with 2.2, 2.3, etc. The corresponding \fIco\fR commands .PP co -r2 f.c and co -r2.1 f.c .PP retrieve the latest revision numbered 2.x and the revision 2.1, respectively. \fICo\fR without a revision number selects the latest revision on the "trunk", i.e., the highest revision with a number consisting of 2 fields. Numbers with more than 2 fields are needed for branches. For example, to start a branch at revision 1.3, invoke .PP ci -r1.3.1 f.c .PP 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 \fIrcsfile\fR(5). .sp .PP .B "RCS File Naming and Location" .PP RCS recognizes two kinds of files; RCS files (revision archives) and working files. Working file names are defined by the RCS user, RCS file names are generated by RCS by appending `\fB,v\fR' to the working file name. Pairs of RCS files and working files may be specified in 3 ways. .PP 1) Both the RCS file and the working file are given. The RCS file name is of the form `\fIpath1/workfile\fR,v' and the working file name is of the form `\fIpath2/workfile\fR', where \fIpath1\fR and \fIpath2\fR are (possibly different or empty) paths and \fIworkfile\fR is a file name. .PP 2) Only the RCS file is given. Then the working file is assumed to be in the current directory and its name is derived from the name of the RCS file by removing \fIpath1/\fR and the suffix `\fB,v\fR'. .PP 3) Only the working file is given. Then the name of the RCS file is derived from the name of the working file by removing \fIpath2/\fR and appending the suffix `\fB,v\fR'. .PP If the RCS file name is omitted or specified without a path, RCS commands look for the RCS file in the directory ./RCS (or the directory it points to if it is a directory link) then in the current working directory. .sp .PP .B "RCS Directory Links" .PP RCS supports directory links. If a regular file named RCS exists in the current working directory, RCS interprets the first line as a path name to the directory where RCS files are stored. RCS will follow a chain of up to ten directory links to reach the RCS directory. Directory links will work with Remote File Access in a LAN environment if you execute an appropriate \fInetunam\fR command before executing RCS commands. .sp .PP .B "Automatic Identification" .PP RCS can put special strings for identification into your source and object code. To obtain such identification, place the marker .PP $\&Header$ .PP into your text, for instance inside a comment. RCS will replace this marker with a string of the form .PP $\&Header: filename revision_number date time author state $ .PP With such a marker on the first page of each module, you can always see with which revision you are working. RCS 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: .PP static char rcsid[] = "$\&Header$"; .PP The command \fIident\fR extracts such markers from any file, even object code and dumps. Thus, \fIident\fR 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 $\&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 \fIco\fR(1) for details. .SH LIMITATIONS RCS files are identified by appending `\fB,v\fR' to the end of the working file name. If necessary, RCS shortens the file name so that `\fB,v\fR' can be appended without exceeding the maximum allowable file name length and warns the user accordingly. Since the maximum file name length for HP-UX is 14 characters, working file names will be shortened to 12 characters. .SH SEE ALSO ci(1), co(1), ident(1), merge(1), rcs(1), rcsdiff(1), rcsmerge(1), rlog(1), rcsfile(5). .br Walter F. Tichy, "Design, Implementation, and Evaluation of a Revision Control System," in \fIProceedings of the 6th International Conference on Software Engineering\fR, IEEE, Tokyo, Sept. 1982.