Title: Source Code Control System (SCCS)
1Source Code Control System (SCCS)
2Introduction
- Programmers Guide, UNIX System V, ATT, 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
3Introduction
- 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.
4Basic 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
5Basic Operation
This is a simple 3 line file
- SCCS adds only the last line to the SCCS file
s.filename and records it as the next revision
6SCCS for Beginners
- Creating an SCCS File via admin
- Retrieving a File via get
- Recording Change via delta
7Creating 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 1317 file1.txt-r--r--r-- 1 sbanyen
ccstaff 178 Feb 16 1317 s.file1.txt
- file1.txt is no longer needed because it exists
now under SCCS as s.file1.txt - rm file1.txt
8Retrieving a File via get
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
9Recording Change via delta
- delta s.file1.txtcomments? Change 3 to
threeNo id keywords (cm7)1.21 inserted1
deleted2 unchanged
10Delta 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.
11Delta 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.
12Delta 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
13Delta Numbering
14Delta Numbering
15SCCS command
- SCCS commands accept two types of arguments
- keyletters
- filenames
16SCCS 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
17SCCS 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
18SCCS 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
19SCCS command
- what searches 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 - comb combines consecutive deltas into one to
reduce the size of an SCCS file - Other can see in man pages of Unix.
20The 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.
21The 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
22The 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
23The 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
24The 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 modules name, etc.
within the g-file. - This information appears in a load module when
one is eventually created.
25The 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
26The 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.
27The 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
28The 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.
29The 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.
30The 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.
31The 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.
32The 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.
33The 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
34The 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.
35Undoing 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.
36The 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 users
login name. If none is found, an error message
results.
37The 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.
38The delta Command
ls -l total 2 -r--r--r-- 1 sbanyen ccstaff
513 Feb 18 1024 s.file1.txt get -e
s.file1.txt 1.2 new delta 1.3 4 lines
39The delta Command
- ls -l
- total 6
- -rw-r--r-- 1 sbanyen ccstaff 33 Feb 18
1024 file1.txt - -rw-r--r-- 1 sbanyen ccstaff 34 Feb 18
1024 p.file1.txt - -r--r--r-- 1 sbanyen ccstaff 513 Feb 18
1024 s.file1.txt
40The delta Command
- delta s.file1.txt
- comments? Add comment
- 1.3
- 1 inserted
- 1 deleted
- 3 unchanged
41The 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.
42The prs Command
- The prs command is used to print all or part of
an SCCS file on the standard output. - prs s.file1.txt
- D 1.1 01/02/17 204450 sbanyen 1 0
00003/00000/00000 - MRs
- COMMENTS
- date and time created 01/02/17 204450 by sbanyen
43The 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
44The prs Command
- Example
- prs -d "File M version I created D"
s.file1.txt - File file1.txt version 1.3 created 01/02/18
45The 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 122338
46The 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.
47The 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 files users list ( or the user
list must be empty). - Example rmdel -r1.3 s.file1.txt
48The 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
49The 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 _at_() which is the
replacement for the Z ID keyword.
50The 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
51The what Command
- The string searched for by what need not be
inserted via and ID keyword of get if may be
inserted in any convenient manner.
52The sccsdiff Command
- The sccsdiff command determines (and prints on
the standard output) the differences between any
two versions of an SCCS file. - The versions to be compared are specified with
sccsdiff -r in the same way as with get -r.
53The sccsdiff Command
- For example
- sccsdiff -r1.2 -r1.3 s.file1.txt
- 1c1
- lt I M
- ---
- gt File name is W
54The comb Command
- The comb command lets t he user try to reduce the
size of an SCCS file, restructs the file by
discarding unwanted deltas and combining other
specified deltas. - In the absence of any keyletters, comb preserves
only leaf deltas and the minimum number of
ancestor deltas necessary to preserve the shape
of an SCCS tree.
55The comb Command
- Deltas 1.2, 1.3.2.1, 1.4 and 2.1 would be
eliminate
56Reference
- Karen S. Fortgang , UNIX System V (Programmers
Guide), Prentice-Hall, Inc., Englewood Cliffs, NJ
07632, 1987. - Robin Burk and David B. Horvath, CCP.,et al.,
UNIX Unreleased Internet Edition, Techmedia
Monish Plaza, 20, Ansari Road, Darya Ganj, New
Delhi-2., 1998. - http//nacphy.physics.orst.edu/copying-with-unix/
node169.html