SCCS Chapter 1
时间:2005-05-17 来源:solaris10_x86
Introduction to SCCS
The SCCS commands form a complete system for creating, editing, converting, or changing the controls on SCCS files. An SCCS file is any text file controlled with SCCS commands. All SCCS files have the prefix s., which sets them apart from regular text files.
Attention: Using non-SCCS commands to edit SCCS files can damage the SCCS files.
Use SCCS commands on an SCCS file. If you wish to look at the structure of an SCCS file, use the pg command or a similar command to view its contents. However, do not use an editor to directly change the file.
To change text in an SCCS file, use an SCCS command (such as the get command) to obtain a version of the file for editing, and then use any editor to modify the text. After changing the file, use the delta command to save the changes. To store the separate versions of a file, and control access to its contents, SCCS files have a unique structure.
An SCCS file is made up of three parts:
- Delta table
- Access and tracking flags
- Body of the text
Delta Table in SCCS files
Instead of creating a separate file for each version of a file, the SCCS file system only stores the changes for each version of a file. These changes are referred to as deltas. The changes are tracked by the delta table in every SCCS file.
Each entry in the delta table contains information about who created the delta, when they created it, and why they created it. Each delta has a specific SID (SCCS IDentification number) of up to four digits. The first digit is the release, the second digit the level, the third digit the branch, and the fourth digit the sequence.
An example of an SID number is:
SID = 1.2.1.4
that is, release 1, level 2, branch 1, sequence 4.
No SID digit can be 0, so there cannot be an SID of 2.0 or 2.1.2.0, for example.
Each time a new delta is created, it is given the next higher SID number by default. That version of the file is built using all the previous deltas. Typically, an SCCS file grows sequentially, so each delta is identified only by its release and level. However, a file may branch and create a new subset of deltas. The file then has a trunk, with deltas identified by release and level, and one or more branches, which have deltas containing all four parts of an SID. On a branch, the release and level numbers are fixed, and new deltas are identified by changing sequence numbers.
Note: A file version built from a branch does not use any deltas placed on the trunk after the point of separation.
Control and Tracking Flags in SCCS Files
After the delta table in an SCCS file, a list of flags starting with the @ (at sign) define the various access and tracking options of the SCCS file. Some of the SCCS flag functions include:
- Designating users who may edit the files
- Locking certain releases of a file from editing
- Allowing joint editing of the file
- Cross-referencing changes to a file
Body of an SCCS file
The SCCS file body contains the text for all the different versions of the file. Consequently, the body of the file does not look like a standard text file. Control characters bracket each portion of the text and specify which delta created or deleted it. When the SCCS system builds a specific version of a file, the control characters indicate the portions of text that correspond to each delta. The selected pieces of text are then used to build that specific version.