home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Linux in a NutshellLinux in a NutshellSearch this book

14.3. General RCS Specifications

This section discusses:

  • Keyword substitution

  • Revision numbering

  • Specifying the date

  • Specifying states

  • Standard options and environment variables

14.3.1. Keyword Substitution

RCS lets you place keyword variables in your working files. These variables are later expanded into revision notes. You can then use the notes either as embedded comments in the input file or as text strings that appear when the output is printed. To create revision notes via keyword substitution, follow this procedure:

  1. In your working file, type any of the keywords listed in the next section.

  2. Check the file in.

  3. Check the file out again. Upon checkout, the co command expands each keyword to include its value. That is, co replaces instances of:

    $keyword$

    with:

    $keyword:value$
  4. Subsequent checkin and checkout of a file will update any existing keyword values. Unless otherwise noted later, existing values are replaced by new values.

TIP: Many RCS commands have a -k option that provides more flexibility during keyword substitution.

14.3.1.2. Example values

Let's assume that the file /projects/new/chapter3 has been checked in and out by a user named daniel. Here's what keyword substitution would produce for each keyword, for the second revision of the file:

Author: daniel $

$Date: 2003/06/26 22:01:15 $

$Header: /projects/new/chapter3,v 1.2 2003/02/25 18:21:10 daniel \
    Exp Locker: daniel $

$Id: ch14_03.htm,v 1.2 2003/06/26 22:01:15 ellie Exp ellie $

$Locker: ellie $

$Log: ch14_03.htm,v $
Revision 1.2  2003/06/26 22:01:15  ellie
fixed stray italics in command options

Revision 1.1  2003/06/26 21:31:52  ellie
Initial revision

#Revision 1.2  2003/02/25 18:21:10  daniel
#Added section on error-handling
#
#Revision 1.1  2003/02/25 16:49:59  daniel
#Initial revision
#

$RCSfile: ch14_03.htm,v $

$Revision: 1.2 $

$Source: /work/nutshell/qref.linux4/cdxml/html/RCS/ch14_03.htm,v $

$State: Exp $

14.3.2. Revision Numbering

Unless told otherwise, RCS commands typically operate on the latest revision. Some commands have an -r option that is used to specify a revision number. In addition, many options accept a revision number as an optional argument. (In the command summary, this argument is shown as [R].) Revision numbers consist of up to four fields—release, level, branch, and sequence—but most revisions consist of only the release and level.

For example, you can check out revision 1.4 as follows:

co -l -r1.4 ch01

When you check it in again, the new revision will be marked as 1.5. But suppose the edited copy needs to be checked in as the next release. You would type:

ci -r2 ch01

This creates revision 2.1. You can also create a branch from an earlier revision. The following command creates revision 1.4.1.1:

ci -r1.4.1 ch01

Numbers are not the only way to specify revisions, though. You can assign a text label as a revision name, using the -n option of ci or rcs. You can also specify this name in any option that accepts a revision number for an argument. For example, you could check in each of your C programs, using the same label regardless of the current revision number:

ci -u -nPrototype *.c

In addition, you can specify a $, which means the revision number is extracted from the keywords of a working file. For example:

rcsdiff -r$ ch01

compares ch01 to the revision that is checked in. You can also combine names and symbols. The command:

rcs -nDraft:$ ch*

assigns a name to the revision numbers associated with several chapter files.

14.3.5. Standard Options and Environment Variables

RCS defines the environment variable RCSINIT, which is used to set up default options for RCS commands. If you set RCSINIT to a space-separated list of options, these options will be prepended to the command-line options you supply to any RCS command. Four options are useful to include in RCSINIT: -q, -V, -x, and -z. They can be thought of as standard options because most RCS commands accept them.

-q[R]
Quiet mode; don't show diagnostic output. R specifies a file revision.

-V[n]
Emulate version n of RCS; useful when trading files between systems that run different versions. n can be 3, 4, or 5. If n is omitted, the command prints the version number of this version of RCS.

-xsuffixes
Specify an alternate list of suffixes for RCS files. Each suffix is separated by a /. On Unix systems, RCS files normally end with the characters ,v. The -x option provides a workaround for systems that don't allow a comma character in filenames.

For example, when depositing a working file into an RCS file, the command:

ci -x,v/ ch01     (second suffix is blank)

searches in order for the RCS filenames:

RCS/ch01,v
ch01,v
RCS/ch01
-z[zone]
Specify the format of the date in keyword substitution. If empty, the default is to output the UTC time with no zone indication. With an argument of LT, the local time zone will be used to output an ISO 8601 format, with an indication of the separation from UTC. You may also specify a numeric UTC offset. For example, -z+4:30 would output a string such as "2002-11-24 02:30:00+4:30".



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.