Source Code Control System Front-End

SCCS stands for Source Code Control System. It consists of a set of tools which can document all changes done to a software system. It comes standard with most Unix System. For a thorough description of SCCS, type (man SCCS) from shell. The following is a description of SCCS front-end scripts that will help us implement a consistent usage of SCCS functions.

       scnew - create new SCCS history file.
      scedit - check out file for editing.
    scupdate - check file into SCCS history. creates a new delta.
     schlist - SCCS history of deltas.
      sccncl - cancels the current work file that was checked out for editing.
       scout - list archive files checked-out for editing.
      sclook - looks at a specific delta.
      scdiff - 'diff' between different deltas or a specific delta against the current work file.
       scget - recreate the workfile from the archive if the workfile is missing.


scnew - create new SCCS history file.

usage:  scnew [-a] source_file...
        -a - allow TABs/SPACEs at the end of line.

scnew will create new SCCS archive file for a source file. The archive file is where SCCS stores the historical changes of a source file and is pre-defined to reside in the .SCCS subdirectory where source file is located. Historical information includes the description of changes made, the user name, and the date and time of modification. Before scnew creates the archive it checks to make sure that your source file contains valid SCCS keywords. Keywords are special strings you may embed in your source-file which has special meaning to SCCS. Creating a new archive for a source file results in the source file being write-protected (chmod -w). To modify the source file, you have to check it out of source-control by using scedit.

scnew also checks to make sure that an archive file does not exist for the source file before it creates one. If an archive file exists. It will display a message and skip the source file.

If the source file as tabs before the end of line, scnew will not proceed unless the -a option is passed. This option is to enforce a smaller source file since trailing white spaces (tabs and spaces) before the end of line is ignored by the compiler anyway.



scedit  -   check out file for editing.

Usage: scedit [-rNNN] source_file...
       where NNN is the delta/version number.

scedit will check out the source file at the latest delta (version or revision), it will lock the latest version of the source file with your user-id. This also disables the write-protect on the source file so you may now modify the source file. Please note that the lock is actually place in the history file for this source, not on the source file itself. So, once a source file is checked-out, anybody could physically modify it but only the user who checked it out may check it back in.

Before a source file is allowed to be checked out at the latest delta for changes, scedit internally compares the source file with the archive version. If they do not match, scedit will fail. This usually means someone overwrote the Write permission on the source file and was able to make changes to the source without authorization from SCCS. When this happens, you have to figure how the source was modified and whether the modification is legitimate. To proceed, you have to rename the unsynchronized source to a different filename then execute scedit again to check-out the source file. If the unauthorized modification is legit, apply the changes to the source.

To branch out from a different delta or revision, you have to specify the revision number you want to branch out from with the -r option. This will check-out the specified revision and once checked-in, the latest version will be a branch from that revision.



scupdate - check file into SCCS history. creates a new delta.

Usage: scupdate [-f comment_file] [-c comment] [-ak] source_file
       -f - use content of comment_file as comment.
       -c - comment is passed as argument.
       -a - allow TABs/SPACEs before the end of line.
       -k - suppress expansion of keywords.

scupdate makes the changes to the source file permanent. It releases the lock on the current revision and stores a new version into the SCCS history file. Note that you may check-in the source file only if you actually own the lock on it. Also, before executing scupdate, please make sure that the changes are stable, i.e., Fully Tested to be Absolutely Correct.

You will be prompted to enter the COMMENT, in which you must describe in summary, the changes you've made for this version. SCCS allows only one line for the comment. Type when done, the source_file will then write-protected.

scupdate checks to make sure you¹ve made changes to a source file before checking it in as a new version. If nothing was done to a source file after checking it out. scupdate will just release the lock and write-protect the source file, in other words, it calls sccncl.



sccncl - cancels the current work file that was checked out for editing.

Usage: sccncl source_file...

To discard the current changes to the source-file after it has been checked-out, use sccncl. sccncl releases the lock on the current version and write-protects the current source file. Use this command is you check out a file by mistake.

schlist - SCCS history of deltas.

Usage: schlist [-n] [source_file...]
       -n prints the name of the user who checked in the revision.

To look at the changes done to the source file, use schlist. schlist shows the history of changes done to the source file. if source_file is not specified, schlist will list the history of all source files in the current directory. To view a history of a single source file, pass the filename as an option. If the source file is currently checked-out for editing, schlist will show "Locked by: user" after the source filename. Example:
$ schlist menulib.c
menulib.c (Locked by: eric)
 1.5        13:29:17 10/11/98 BF f8 item display not adding offset.
 1.4        10:07:14 03/17/98 +print_sw,ATTRSW_*,chk_print().
 1.3        10:49:54 02/28/98 +auto x_offset/y_offset.
 1.2        13:22:55 01/23/98 +symbolic menu.
 1.1        16:40:08 12/09/96 initial SCCS file created.

When option -n is passed, schlist will also display the name of the user who modified the revision.

Example:

$ schlist -n menulib.c
menulib.c (Locked by: eric)
 1.5     eric    13:29:17 10/11/98 BF f8 item display not adding offset.
 1.4     eric    10:07:14 03/17/98 +print_sw,ATTRSW_*,chk_print().
 1.3     eric    10:49:54 02/28/98 +auto x_offset/y_offset.
 1.2     eric    13:22:55 01/23/98 +symbolic menu.
 1.1     eric    16:40:08 12/09/96 initial SCCS file created.



scout - list archive files checked-out for editing.

Usage: scout [-R] [-w] [directory...]
       -R - Recursively seach for locked sources
       -w - show only the name of the sources which are locked.
       -u user - list only locked files for user.
       If directory is not specified, current directory is assumed.

scout will list all the checked-out archive files for the directories specified. If no directory is passed, the current directory is assumed. It will recursively show all locked sources from the current if the -R option is passed. Each line will show the locked source file, the owner of the lock and the version locked.

Example:

$ scout
Makefile        eric    1.6
menulib.c       eric    1.8
menulib.h       eric    1.5
screen.c        eric    1.14
stredit.c       eric    1.5
stredit.h       eric    1.1

When -w is passed to scout, it will show only the source files which are locked. The owner and the revision number will not be displayed.

Example:

$ scout -w
Makefile
menulib.c
menulib.h
screen.c
stredit.c
stredit.h

This option is mostly used from a sub-shell to pass the list of locked files to a command from shell such as:

$ scupdate `scout -w`



sclook - looks at a specific delta.

Usage: sclook [-rNNN] source_file...
       -r - NNN is a revision number.

sclook will print the latest version of the file to the standard output. You may specify the delta or version number of the file to be shown. As in sclook -r1.2 menulib.c.

scdiff - 'diff' between different deltas or a specific delta against the current work file.

Usage: scdiff [-rNNN] [-rOOO] [-k] source_file...
       NNN is the first revision number
       OOO is the second revision number
       -k - suppress expansion of keywords.

scdiff will print the difference between the latest version of the source file and the current workfile. You may specify the revision number of the files to be diff'd.

The first two lines of the scdiff script output tells you which file the '<' or '>' of the diff output is referring to. It will say Œworkfile¹ and Œarchive¹ if scdiff is doing a diff between the workfile and archive files. If will display 'archive -r????' if the diff is between different revisions.

Example:

$ scdiff -r1.47 -r1.48 pordrdt.ec
< - archive -r1.47
> - archive -r1.48
5c5
< @(#) pordrdt.ec  1.47
---
> @(#) pordrdt.ec  1.48
787c787
<       int ser_no= 1;
---
>       int ser_no= 0;
794,795c794,795
<               if (l_mdtpord->ser_no>= ser_no)
<                       ser_no= l_mdtpord->ser_no+ 1;
---
>               if (ser_no< l_mdtpord->ser_no)
>                       ser_no= l_mdtpord->ser_no;



scget - get the most recent copy of the workfile from the archive.

Usage: scget [-k] source_file..
       -k suppress SCCS keyword exapnasion.

scget gets the most recent version of the source from the SCCS archive and saves it to the workfile. You use scget when your workfile is corrupt or was deleted by mistake. Doing a: "scget source_file" is almost the same as ³sclook source_file >work_file² but scget goes a little further and checks to see if the workfile is locked. If it is, it automatically takes the write permission off the workfile for you. So the integrity of the workfile is preserved. If workfile exists, scget will not override it.

To be consistent, the SCCS front-end scripts will require you to have SCCS keywords in your source file before you can create an archive or check-in a source file. If the SCCS keywords are missing, the SCCS front-end script will refuse to proceed.

If you have the following keywords on your source file:

# @(#) %M%  %I%

it will be expanded to:

# @(#) scget  1.3

Environment

The following variables should be set properly in order for the SCCS front-end scripts to work.

    SCCS=.SCCS; export SCCS

The following programs and shell scripts are required by one or more SCCS front-end scripts:

   filespec - gets the system specifications of a file, such as mod-time, create-time, etc. Used by
              scupdate to get the owner of the source-file for file-permission tests. This is a c
              compiled object.
    scqdiff - QuickDiff to find out if the check-out souce has been modified.
    sctouch - Sets the last modified date and time of the workfile.
  scfixmode - Change mode for workfile created by the front-end script. Primarily for write or
              executable mode.

Please email any bug-report, comments or suggestions to eric@panix.com.