570 likes | 738 Views
Source Code Control System (SCCS). Banyen Sae-Lee 4322031. Introduction. [Programmer’s Guide, UNIX System V, AT&T, 1987] Is a maintenance and enhancement tracking tool that runs under the UNIX system. [http://nacphy.physics.orst.edu/copying-with-unix/node169.html]
E N D
Source Code Control System (SCCS) Banyen Sae-Lee 4322031 SCCS
Introduction [Programmer’s Guide, UNIX System V, AT&T, 1987] • Is a maintenance and enhancement tracking tool that runs under the UNIX system • [http://nacphy.physics.orst.edu/copying-with-unix/node169.html] • The source code control system SCCS is a set of commands which helps you keep track of the changes made to source code (or any text) files SCCS
Introduction It's like a friendly librarian and accountant for your files who even helps you restore your files to the condition they were in at some previous time. The SCCS is particularly handy when a group is making changes to the same source code or a single person likes to try out lots of changes but keeps forgetting how to get the code back to where it runs. SCCS
Basic Operation • SCCS stores changes to files in a file that is called, logically, An SCCS file. • The SCCS file is named s.filename, where filename is the file being tracked. • Each set of changes depending on the previous revision SCCS
This is a simple three line file Next revision Basic Operation SCCS adds only the last line to the SCCS file s.filename and records it as the next revision This is a simple 3 line file SCCS
SCCS for Beginners • Creating an SCCS File via admin • Retrieving a File via get • Recording Change via delta SCCS
Creating an SCCS File via admin file1.txt This is a simple 3 line $ admin –ifile1.txt s.file1.txt $ ls –l-rw-r--r-- 1 sbanyen ccstaff 24 Feb 16 13:17 file1.txt-r--r--r-- 1 sbanyen ccstaff 178 Feb 16 13:17 s.file1.txt file1.txt is no longer needed because it exists now under SCCS as s.file1.txt $ rm file1.txt SCCS
Retrieving a File via get $ get s.file1.txt $ get –e s.file1.txt 1.13 lines No ID keywords (cm7) get retrieved version 1.1 with three lines of text for reading 1.1new delta 1.23 lines get creates file1.txt for both reading and writing SCCS
Recording Change via delta $ delta s.file1.txtcomments? Change 3 to threeNo id keywords (cm7)1.21 inserted1 deleted2 unchanged SCCS
Delta Numbering • Think of deltas as the nodes of a tree in which the root nodes is the original version of the file. • The root is normally named 1.1 and deltas (nodes) are named 1.2, 1.3, etc. • The components of these SIDs are called release and level numbers. SCCS
Delta Numbering • This is the normal sequential development of an SCCS file, which each delta dependent on the preceding deltas. • Such struture is called the trunk of an SCCS tree. SCCS
Delta Numbering • There are situation the require branching an SCCS file. That is, changes are planned to a given delta that will not be dependent on all previous deltas. • Branch delta names always have fours SID components: release.level.branch.sequence SCCS
Delta Numbering SCCS
Delta Numbering SCCS
SCCS command SCCS commands accept two types of arguments • keyletters • filenames SCCS
SCCS command • admin initializes SCCS files, manipulates their descriptive text, and controls delta creation rights • get retrieves versions of SCCS files • unget undoes the effect of a get -e prior to the file being deltaed SCCS
SCCS command • delta applies (changes) to SCCS files and creates new versions • prs prints portions of an SCCS file in user specified format • sact print information about the fils that are currently out for edit SCCS
SCCS command • rmdel removes a delta from an SCCS file allows removal of deltas created by mistake • cdc changes the commentary assocoated with a delta • sccsdif shows differences between any two versions of an SCCS file SCCS
SCCS command • whatsearches any UNIX system file(s) for all occurences of a special pattern and prints out what follows it useful in filnding identifying information inserted by the get command • combcombines consecutive deltas into one to reduce the size of an SCCS file • Other can see in man pages of Unix. SCCS
The admin Command The admin command is used to administer SCCS file.When an SCCS file is created, its parameters are initialized by use of keyletters with admin or are assigned default values if no keyletters are supplied. SCCS
The admin Command • Initialize the history file with text from the indicated file. • Create the history file called s.program.c in the SCCS subdirectory. • Specify the release for the initial delta. $ admin –ifile1.txt s.file1.txt $ create SCCS file1.txt $ admin –ifile1.txt –r3 s.file1.txt SCCS
The admin Command • SCCS files contain a list of login names and/or group Ids of users who are allowed to create deltas. • This list is empty by default, allowing anyone to create deltas. • To create a user list (or add to an existing one), admin -a is used. For example $ admin-assupacho -avpreecha s.file1.txt SCCS
The get Command The get utility retrieves a working copy from the SCCS history file, according to the specified options. The retrieved file normally has the same filename base as the s.file, less the prefix, and is referred to as the g- file. • retrieve a version of an SCCS file$ get s.file1.txt SCCS
The get Command ID keywords (Identification keywords) • In generating a g-file for compilation, it is useful to record the date and time of creation, the version retrieved, the module’s name, etc. within the g-file. • This information appears in a load module when one is eventually created. SCCS
The get Command ID keywords (Identification keywords) • ID keywords appearing anywhere in the generated file are replaced by appropriate values according to the definitions of those ID keywords SCCS
The get Command ID keywords (Identification keywords) • The format of an ID keyword is an upper case letter emclosed by percent signs, %. For example%I% is the ID keyword replaced by the SID of the retrieved version of a file. SCCS
The get Command • Retrieve the version corresponding to the indicated SID (delta).$ get –r s.file1.txt • Retrieve a version for editing$ get -e s.file1.txt • Create a new branch.$ get –b –e –r1.2 s.file1.txt SCCS
The get Command Retrieval With Intent to Make a Delta get -e indicates an intent to make a delta. First, get checks the following. • The user list to determine if the login name or group ID of the person executing get is present. The login name or group-ID of the person executing get must be present for the user to be allowed to make deltas. SCCS
The get Command Retrieval With Intent to Make a Delta • The release number (R) of the version being retrieved statisfies the relation “floor is greater than or equal to R, which is less than or equal to ceiling” to determine if the release being accessed is a protected release. The floor and ceiling are flags in the SCCS file representing start and end of range. SCCS
The get Command Retrieval With Intent to Make a Delta • The R is not locked against editing. The lock is a flag in the SCCS file. • Whether multiple concurrent edits are allowed for the SCCS file by the j flag in the SCCS file. SCCS
The get Command Retrieval With Intent to Make a Delta • A failure of any of the first three conditions causes the processing of the corresponding SCCS file to terminate. • If the above checks succeed, get -e causes the creation of a g-file in the current directory with mode 644, owned by the real user. SCCS
The get Command Retrieval With Intent to Make a Delta • If a writable g-file already exists, get terminates with an error.This is prevent inadvertent destruction of a g-file being edited for the purpose of maling a delta. • get -e causes the creation (or updating) of a p.filename that is used to pass information to the delta command. SCCS
The get Command Retrieval With Intent to Make a Delta • The p.filename prevents other users from retrieving the same version for editing until this one is checked in using delta or unget. • Read only copied can be check out. • Can use the -r option for different versions at the same time SCCS
The get Command Retrieval With Intent to Make a Delta • However, if two users are making changes to the same file at the same time, the project most likely will have branches in the revision tree. SCCS
Undoing a get -e • There may be times when a file is retrieved for editing in error; there is really no editing that needs to be done at this time.In such cases, the unget command can be used to cancel the delta reservation that was set up. SCCS
The delta Command • The delta command is used to incorporate changes made to a g-file into the corresponding SCCS file • The delta command requ ires the existence of a p.filename. It examines the p.filename to verify the presence of an entry containing the user’s login name. If none is found, an error message results. SCCS
The delta Command • If all checks are successful, delta determines what has been changed in the g-file by comparing it via diff (1) with its own temporary copy of the g-file as it was before editing. • If the login name of the user appears in more than one entry, Then delta -r must be used to specify the SID that uniquely identifies the p.filename entry. SCCS
The delta Command $ ls -l total 2 -r--r--r-- 1 sbanyen ccstaff 513 Feb 18 10:24 s.file1.txt $ get -e s.file1.txt 1.2 new delta 1.3 4 lines SCCS
The delta Command $ ls -l total 6 -rw-r--r-- 1 sbanyen ccstaff 33 Feb 18 10:24 file1.txt -rw-r--r-- 1 sbanyen ccstaff 34 Feb 18 10:24 p.file1.txt -r--r--r-- 1 sbanyen ccstaff 513 Feb 18 10:24 s.file1.txt SCCS
The delta Command $ delta s.file1.txt comments? Add comment 1.3 1 inserted 1 deleted 3 unchanged SCCS
The delta Command After the processing of an SCCS file is complete, the corresponding p.filename emtry is removed from the p.filename. delta removes the edited g-file unless -n is specified. For example delta -n s.file1.txt will keep the g-file after processing. SCCS
The prs Command The prs command is used to print all or part of an SCCS file on the standard output. $ prss.file1.txt D 1.1 01/02/17 20:44:50 sbanyen 1 0 00003/00000/00000 MRs: COMMENTS: date and time created 01/02/17 20:44:50 by sbanyen SCCS
The prs Command If prs -d is used, the output will be in a format called data specification. Data specification is a string of SCCS file data keywords interspersed with optional user text. Data keywords are replaced by appropriate values according to their definition SCCS
The prs Command Example $ prs -d "File:M:version::I:created::D:" s.file1.txt File file1.txt version: 1.3 created: 01/02/18 SCCS
The sact Command sact is like a special form of the prs command that produces a report about files that are out for edit.The command takes only one type of argument: a list of file or directory name. $ sact s.file1.txt 1.3 1.4 sbanyen 01/02/18 12:23:38 SCCS
The rmdel Command The rmdel command allows removal of a delta from an SCCS file. • The delta to be removed must be leaf delta. • The effective user must have write permission is the directory containing the SCCS file. SCCS
The rmdel Command • Check the SID to make sure it is not for a version on which a get for editing had been executed and whose associated delta has not yet been made. • The login name or group ID of the user must appear in the file’s user’s list ( or the user list must be empty). Example $ rmdel -r1.3 s.file1.txt SCCS
The cdc Command The cdc command is used to changed the commentary made when the delta was created. It is similar to the rmdel command (e.g., -r and full SID are necessary) although the delta need not be a leaf delta. For example $ cdc-r1.2 s.file1.txt comments?Change number 3 to three word SCCS
The what Command The what command is used to find identifying within any UNIX file whose name is given as an argument. No keyletters are accepted. The what command search the given file(s) for all occurences of the string @(#) which is the replacement for the %Z% ID keyword. SCCS
The what Command For example, if an SCCS file called s.file1.txt contains the following line: Filename is %W% and the command $ get s.file1.txt $ what file1.txt file1.txt: file1.txt 1.3 SCCS