sccs1 source code control system (sccs) banyen sae-lee 4322031
TRANSCRIPT
SCCS 1
Source Code Source Code Control System Control System (SCCS)(SCCS)
Banyen Sae-Lee Banyen Sae-Lee
43220314322031
SCCS 2
Introduction Introduction [Programmer’s Guide, UNIX System V, AT&T, 1987][Programmer’s Guide, UNIX System V, AT&T, 1987] Is a maintenance and enhancement Is a maintenance and enhancement
tracking tool that runs under the UNIX tracking tool that runs under the UNIX systemsystem
[http://nacphy.physics.orst.edu/[http://nacphy.physics.orst.edu/copying-with-unix/node169.html]copying-with-unix/node169.html]
The source code control The source code control system SCCS is a set of system SCCS is a set of commands which helps you commands which helps you keep track of the changes keep track of the changes made to source code (or made to source code (or any text) filesany text) files
SCCS 3
IntroductionIntroductionIt'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 4
Basic OperationBasic OperationSCCS stores changes to files in a SCCS stores changes to files in a
file that is called, logically, file that is called, logically, An An SCCS file.SCCS file.
The SCCS file is named The SCCS file is named s.filenames.filename, , where where filenamefilename is the file being is the file being tracked.tracked.
Each set of changes depending on Each set of changes depending on the previous revisionthe previous revision
SCCS 5
Basic OperationBasic Operation
This isa simplethree line file
Next revision
SCCS adds only the last line SCCS adds only the last line to the SCCS file s.filename and to the SCCS file s.filename and records it as the next revisionrecords it as the next revision
This isa simple3 line file
SCCS 6
SCCS for BeginnersSCCS for Beginners
Creating an SCCS File Creating an SCCS File via adminvia admin
Retrieving a File via Retrieving a File via getget
Recording Change via Recording Change via deltadelta
SCCS 7
Creating an SCCS Creating an SCCS File via adminFile via adminfile1.txtfile1.txt
This isThis is
a a simplsimple e
3 line3 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.txtfile1.txt is no longer needed because it exists now under SCCS as s.file1.txt $ rm file1.txt
SCCS 8
Retrieving a File Retrieving a File via getvia get$ get s.file1.txt
1.13 lines
7No ID keywords (cm )
rrrrrrrrr rrrrrrr r1 rrrr rrrrr rrrrr rr .1
rrrr rrr rrrrrrr
$ get –e s.file1.txt
1.1new delta 1.23 lines
get creates file1.txt for both reading and writing
SCCS 9
Recording Recording Change via deltaChange via delta
$ delta s.file1.txt comments? 3Change to three
No id keywords (cm7 )12. 1i nser t ed rrrrrrr1
2 unchanged
SCCS 10
Delta NumberingDelta Numbering
Think of deltas as the nodes of a Think of deltas as the nodes of a tree in which the root nodes is the tree in which the root nodes is the original version of the file.original version of the file.
The root is normally named 1.1 and The root is normally named 1.1 and deltas (nodes) are named 1.2, 1.3, deltas (nodes) are named 1.2, 1.3, etc.etc.
The components of these SIDs are The components of these SIDs are called release and level numbers.called release and level numbers.
SCCS 11
Delta NumberingDelta Numbering
This is the normal sequential This is the normal sequential development of an SCCS file, which development of an SCCS file, which each delta dependent on the preceding each delta dependent on the preceding deltas.deltas.
Such struture is called the trunk of an Such struture is called the trunk of an SCCS tree.SCCS tree.
SCCS 12
Delta NumberingDelta NumberingThere are situation the require There are situation the require
branching an SCCS file. That is, branching an SCCS file. That is, changes are planned to a given changes are planned to a given delta that will not be dependent on delta that will not be dependent on all previous deltas.all previous deltas.
Branch delta names always have Branch delta names always have fours SID components:fours SID components:
release.level.branch.sequencerelease.level.branch.sequence
SCCS 13
Delta NumberingDelta Numbering
SCCS 14
Delta NumberingDelta Numbering
SCCS 15
SCCS commandSCCS command
SCCS commands accept two SCCS commands accept two types of argumentstypes of arguments
keyletterskeylettersfilenamesfilenames
SCCS 16
SCCS commandSCCS command
adminadmin initializes SCCS files, initializes SCCS files, manipulates their descriptive text, manipulates their descriptive text, and controls delta creation rightsand controls delta creation rights
getget retrieves versions of SCCS files retrieves versions of SCCS filesungetunget undoes the effect of a get -e undoes the effect of a get -e
prior to the file being deltaedprior to the file being deltaed
SCCS 17
SCCS commandSCCS command
deltadelta applies (changes) to SCCS applies (changes) to SCCS files and creates new versionsfiles and creates new versions
prsprs prints portions of an SCCS prints portions of an SCCS file in user specified formatfile in user specified format
sactsact print information about the print information about the fils that are currently out for editfils that are currently out for edit
SCCS 18
SCCS commandSCCS command
rmdelrmdel removes a delta from an removes a delta from an SCCS file allows removal of deltas SCCS file allows removal of deltas created by mistakecreated by mistake
cdc cdc changes the commentary changes the commentary assocoated with a deltaassocoated with a delta
sccsdifsccsdif shows differences shows differences between any two versions of an between any two versions of an SCCS fileSCCS file
SCCS 19
SCCS commandSCCS commandwhatwhat searches any UNIX system file(s) searches any UNIX system file(s)
for all occurences of a special pattern for all occurences of a special pattern and prints out what follows it useful in and prints out what follows it useful in filnding identifying information inserted filnding identifying information inserted by the get commandby the get command
combcomb combines consecutive deltas into combines consecutive deltas into one to reduce the size of an SCCS fileone to reduce the size of an SCCS file
Other can see in man pages of Unix.Other can see in man pages of Unix.
SCCS 20
The admin CommandThe admin Command
TheThe admin admin command is used command is used to administer SCCS file.When to administer SCCS file.When an SCCS file is created, its an SCCS file is created, its parameters are initialized by parameters are initialized by use of keyletters with admin or use of keyletters with admin or are assigned default values if are assigned default values if no keyletters are supplied.no keyletters are supplied.
SCCS 21
Initialize the history file with text f Initialize the history file with text f rom the indicated file. rom the indicated file.
Create the history file called s.progr Create the history file called s.progr am.c in the SCCS subdirectory. am.c in the SCCS subdirectory.
Specify the release for the initial Specify the release for the initialdelta.delta.
The admin CommandThe admin Command
$ admin –ifile1.txt s.file1.txt
$ create SCCS file1.txt
$ admin –ifile1.txt –r3 s.file1.txt
SCCS 22
The admin CommandThe admin Command SCCS files contain a list of login names SCCS files contain a list of login names
and/or group Ids of users who are and/or group Ids of users who are allowed to create deltas.allowed to create deltas.
This list is empty by default, allowing This list is empty by default, allowing anyone to create deltas.anyone to create deltas.
To create a user list (or add to an To create a user list (or add to an existing one), existing one), admin -aadmin -a is used. For is used. For exampleexample
$ admin$ admin -assupacho -avpreecha s.file1.txt-assupacho -avpreecha s.file1.txt
SCCS 23
The get CommandThe get Command
The get utility retrieves a working copy The get utility retrieves a working copy from the SCCS history file, according from the SCCS history file, according to the specified options. to the specified options.
The retrieved file normally has the same The retrieved file normally has the same filename base as the s.file, less filename base as the s.file, less the prefix, and is referred to as the the prefix, and is referred to as the g- file.g- file.
retrieve a version of an SCCS fileretrieve a version of an SCCS file$ get s.file1.txt$ get s.file1.txt
SCCS 24
The get CommandThe get Command
ID keywordsID keywords (Identification (Identification keywords)keywords)
In generating a g-file for compilation, it In generating a g-file for compilation, it is useful to record the date and time of is useful to record the date and time of creation, the version retrieved, the creation, the version retrieved, the module’s name, etc. within the g-file.module’s name, etc. within the g-file.
This information appears in a load This information appears in a load module when one is eventually created.module when one is eventually created.
SCCS 25
The get CommandThe get Command
ID keywordsID keywords (Identification keywords)(Identification keywords)
ID keywords appearing ID keywords appearing anywhere in the generated file anywhere in the generated file are replaced by appropriate are replaced by appropriate values according to the values according to the definitions of those ID keywordsdefinitions of those ID keywords
SCCS 26
The get CommandThe get Command
ID keywordsID keywords (Identification (Identification keywords)keywords)
The format of an ID keyword is an The format of an ID keyword is an upper case letter emclosed by upper case letter emclosed by percent signs, %. For examplepercent signs, %. For example %I%I%% is the ID keyword replaced by is the ID keyword replaced by the SID of the retrieved version of the SID of the retrieved version of a file. a file.
SCCS 27
The get CommandThe get Command
Retrieve the version correspond Retrieve the version correspond ing to the indicated SID (delta). ing to the indicated SID (delta).
$ get –r s.file1.txt Retrieve a version for editing Retrieve a version for editing
- $ get e s.file1.txt Create a new branch. Create a new branch.
$ get –b –e –r1.2 s.file1.txt
SCCS 28
The get Command The get Command
Retrieval With Intent to Make a Retrieval With Intent to Make a DeltaDelta
get -e indicates an intent to make a get -e indicates an intent to make a delta. First, get checks the following.delta. First, get checks the following.
The user list to determine if the login name The user list to determine if the login name or group ID of the person executing get is or group ID of the person executing get is present. The login name or group-ID of the present. The login name or group-ID of the person executing get must be present for person executing get must be present for the user to be allowed to make deltas.the user to be allowed to make deltas.
SCCS 29
The get CommandThe get Command
Retrieval With Intent to Make a Retrieval With Intent to Make a DeltaDelta
The release number (R) of the version bein The release number (R) of the version bein g retrieved statisfies the relation “ g retrieved statisfies the relation “ floor is g floor is g
reater than or equal to R, which is less tha reater than or equal to R, which is less tha n or equal to ceiling n or equal to ceiling ” to determine if the re ” to determine if the re
lease being accessed is a protected releas lease being accessed is a protected releas e. The floor and ceiling are flags in the SCC e. The floor and ceiling are flags in the SCC
S file representing start and end of range. S file representing start and end of range.
SCCS 30
The get CommandThe get Command
Retrieval With Intent to Retrieval With Intent to Make a DeltaMake a Delta
The R is not locked against editing The R is not locked against editing . The lock is a flag in the SCCS file. . The lock is a flag in the SCCS file.
Whether multiple concurrent edits Whether multiple concurrent edits are allowed for the SCCS file by th are allowed for the SCCS file by th
e j flag in the SCCS file. e j flag in the SCCS file.
SCCS 31
The get CommandThe get Command
Retrieval With Intent to Make a Retrieval With Intent to Make a DeltaDelta
A failure of any of the first three condition A failure of any of the first three condition s causes the processing of the correspon s causes the processing of the correspon
ding SCCS file to terminate. ding SCCS file to terminate. If the above checks succeed, If the above checks succeed, - get e cause - get e cause
-s the creation of a g file -s the creation of a g file in the current dir in the current dir ectory with mode 644, owned by the real ectory with mode 644, owned by the real
user. user.
SCCS 32
The get CommandThe get Command
Retrieval With Intent to Make a Retrieval With Intent to Make a DeltaDelta
If a writable If a writable g-file already existsg-file already exists, get , get terminates with an error.This is prevent terminates with an error.This is prevent inadvertent destruction of a g-file being inadvertent destruction of a g-file being edited for the purpose of maling a delta.edited for the purpose of maling a delta.
- get e causes the creation (or updating) of - get e causes the creation (or updating) of a a p.filenamep.filename that is used to pass informa that is used to pass informa
tion to the delta command. tion to the delta command.
SCCS 33
The get CommandThe get Command
Retrieval With Intent to Make a Retrieval With Intent to Make a DeltaDelta
The The p.filenamep.filename prevents other users prevents other users from retrieving the same version for from retrieving the same version for editing until this one is checked in using editing until this one is checked in using delta or unget.delta or unget.
Read only copied can be check out.Read only copied can be check out. Can use the -r option for different Can use the -r option for different
versions at the same timeversions at the same time
SCCS 34
The get CommandThe get Command
Retrieval With Intent to Retrieval With Intent to Make a DeltaMake a Delta
However, if two users are However, if two users are making changes to the same making changes to the same file at the same time, the file at the same time, the project most likely will have project most likely will have branches in the revision tree.branches in the revision tree.
SCCS 35
Undoing a get -eUndoing a get -e
There may be times when a file There may be times when a file is retrieved for editing in error; is retrieved for editing in error; there is really no editing that there is really no editing that needs to be done at this time.In needs to be done at this time.In such cases, the such cases, the ungetunget command command can be used to cancel the delta can be used to cancel the delta reservation that was set up.reservation that was set up.
SCCS 36
The delta CommandThe delta Command
The delta command is used to The delta command is used to incorporate changes made to a incorporate changes made to a g-fileg-file into the corresponding SCCS fileinto the corresponding SCCS file
The delta command requ ires the The delta command requ ires the existence of a existence of a p.filenamep.filename. It . It examines the examines the p.filenamep.filename to verify the to verify the presence of an entry containing the presence of an entry containing the user’s login nameuser’s login name. If none is found, . If none is found, an error message results.an error message results.
SCCS 37
The delta CommandThe delta Command
If all checks are successful, If all checks are successful, deltadelta determines what has been changed in determines what has been changed in the the g-fileg-file by comparing it via by comparing it via diff (1) diff (1) with its own temporary copy of the g-with its own temporary copy of the g-file as it was before editing.file as it was before editing.
If the login name of the user appears in If the login name of the user appears in more than one entry, Then more than one entry, Then delta -rdelta -r must be used to specify the SID that must be used to specify the SID that uniquely identifies the p.filename entry.uniquely identifies the p.filename entry.
SCCS 38
The delta CommandThe delta Command$ ls -l$ ls -l
total 2total 2
-r--r--r-- 1 sbanyen ccstaff -r--r--r-- 1 sbanyen ccstaff 513 Feb 18 10:24 s.file1.txt 513 Feb 18 10:24 s.file1.txt
$ get -e s.file1.txt$ get -e s.file1.txt
1.21.2
new delta 1.3new delta 1.3
4 lines4 lines
SCCS 39
The delta CommandThe delta Command
$ ls -l$ ls -l
total 6total 6
-rw-r--r-- 1 sbanyen ccstaff 33 -rw-r--r-- 1 sbanyen ccstaff 33 Feb 18 10:24 file1.txtFeb 18 10:24 file1.txt
-rw-r--r-- 1 sbanyen ccstaff 34 -rw-r--r-- 1 sbanyen ccstaff 34 Feb 18 10:24 p.file1.txtFeb 18 10:24 p.file1.txt
-r--r--r-- 1 sbanyen ccstaff 513 -r--r--r-- 1 sbanyen ccstaff 513 Feb 18 10:24 s.file1.txtFeb 18 10:24 s.file1.txt
SCCS 40
The delta CommandThe delta Command
$ delta s.file1.txt$ delta s.file1.txt
comments? comments? Add commentAdd comment
1.31.3
1 inserted1 inserted
1 deleted1 deleted
3 unchanged3 unchanged
SCCS 41
The delta CommandThe delta CommandAfter the processing of an SCCS After the processing of an SCCS
file is complete, the corresponding file is complete, the corresponding p.filename emtry is removed from p.filename emtry is removed from the p.filename.the p.filename.
delta removes the edited delta removes the edited g-fileg-file unless unless -n-n is specified. For example is specified. For example
delta -n s.file1.txtdelta -n s.file1.txt
will keep the g-file after processing.will keep the g-file after processing.
SCCS 42
The prs CommandThe prs Command
The The prsprs command is used to print all or command is used to print all or part of an SCCS file on the standard output.part of an SCCS file on the standard output.
$ prs$ prs s.file1.txts.file1.txtD 1.1 01/02/17 20:44:50 sbanyen 1 0 D 1.1 01/02/17 20:44:50 sbanyen 1 0
00003/00000/0000000003/00000/00000
MRs:MRs:
COMMENTS:COMMENTS:
date and time created 01/02/17 20:44:50 by date and time created 01/02/17 20:44:50 by sbanyensbanyen
SCCS 43
The prs CommandThe prs Command
If prs -d is used, the output will be If prs -d is used, the output will be in a format called in a format called data specificationdata specification..
Data specificationData specification is a string of is a string of SCCS file SCCS file data keywordsdata keywords interspersed interspersed with optional user text.with optional user text.
Data keywordsData keywords are replaced by are replaced by appropriate values according to their appropriate values according to their definitiondefinition
SCCS 44
The prs CommandThe prs Command
ExampleExample
$ prs -d$ prs -d "File "File :M::M: version:version: :I::I: created:created: :D::D:" s.file1.txt" s.file1.txt
File file1.txt version: 1.3 File file1.txt version: 1.3 created: 01/02/18 created: 01/02/18
SCCS 45
The sact CommandThe sact Command
sact is like a special form of the prs sact is like a special form of the prs command that produces a report command that produces a report about about files that are out for editfiles that are out for edit.The .The command takes only one type of command takes only one type of argument: a list of file or directory argument: a list of file or directory name.name.
$ sact s.file1.txt$ sact s.file1.txt
1.3 1.4 sbanyen 01/02/18 12:23:381.3 1.4 sbanyen 01/02/18 12:23:38
SCCS 46
The rmdel CommandThe rmdel Command
The The rmdelrmdel command allows command allows removal of a delta from an SCCS file.removal of a delta from an SCCS file.
The delta to be removed must be The delta to be removed must be leaf delta.leaf delta.
The effective user must have write The effective user must have write permission is the permission is the directory directory containing the SCCS file.containing the SCCS file.
SCCS 47
The rmdel CommandThe rmdel Command
Check the SID to make sure it is not for Check the SID to make sure it is not for a version on which a get for editing a version on which a get for editing had been executed and whose had been executed and whose associated delta has not yet been associated delta has not yet been made.made.
The login name or group ID of the user The login name or group ID of the user must appear in the file’s user’s list ( or must appear in the file’s user’s list ( or the user list must be empty).the user list must be empty).
Example Example $ rmdel$ rmdel -r1.3 s.file1.txt -r1.3 s.file1.txt
SCCS 48
The cdc Command The cdc Command
The The cdccdc command is used to changed the command is used to changed the commentary made when the delta was commentary made when the delta was created. It is similar to the rmdel command created. It is similar to the rmdel command (e.g., -r and full SID are necessary) (e.g., -r and full SID are necessary) although although the delta need not be a leaf deltathe delta need not be a leaf delta. .
For example $ cdc - 12 1r . s.file .txt
comments? rrr rrr r 3 to three word
SCCS 49
The what CommandThe what Command
The The whatwhat command is used to find command is used to find identifying within any UNIX file whose identifying within any UNIX file whose name is given as an argument. No name is given as an argument. No keyletters are accepted. keyletters are accepted.
TheThe what what command search the command search the given file(s) for all occurences of the given file(s) for all occurences of the string string @(#)@(#) which is the replacement which is the replacement for the for the %Z% ID keyword%Z% ID keyword..
SCCS 50
The what CommandThe what Command
For example, if an SCCS file called For example, if an SCCS file called s.file1.txt contains the following line:s.file1.txt contains the following line:
Filename is %W% Filename is %W% and the and the commandcommand
$ get$ get s.file1.txt s.file1.txt
$ what$ what file1.txt file1.txt
file1.txt:file1.txt:
file1.txt 1.3file1.txt 1.3
SCCS 51
The what CommandThe what Command
The string searched for by The string searched for by what need not be inserted via what need not be inserted via and ID keyword of get; if may and ID keyword of get; if may be inserted in any convenient be inserted in any convenient manner.manner.
SCCS 52
The sccsdiff The sccsdiff CommandCommand
The The sccsdiff sccsdiff command command determines (and prints on the determines (and prints on the standard output) the differences standard output) the differences between any two versions of an between any two versions of an SCCS file.SCCS file.
The versions to be compared are The versions to be compared are specified with sccsdiff -r in the specified with sccsdiff -r in the same way as with get -r. same way as with get -r.
SCCS 53
The sccsdiff The sccsdiff CommandCommand
For exampleFor example
$ $ sccsdiffsccsdiff -r1.2 -r1.3 s.file1.txt -r1.2 -r1.3 s.file1.txt 1c11c1
< %I% %M%< %I% %M%
------
> File name is %W%> File name is %W%
SCCS 54
The comb CommandThe comb Command
The The combcomb command lets t he user try to command lets t he user try to reduce the size of an SCCS file, restructs reduce the size of an SCCS file, restructs the file by discarding unwanted deltas the file by discarding unwanted deltas and combining other specified deltas.and combining other specified deltas.
In the absence of any keyletters, In the absence of any keyletters, comb comb preserves only leaf deltaspreserves only leaf deltas and and the the minimum number of ancestor deltas minimum number of ancestor deltas necessary to preserve the shape of an necessary to preserve the shape of an SCCS tree.SCCS tree.
SCCS 55
The comb CommandThe comb Command
Deltas 1.2, 1.3.2.1, 1.4 and 2.1 would be eliminateDeltas 1.2, 1.3.2.1, 1.4 and 2.1 would be eliminate
SCCS 56
ReferenceReference Karen S. Fortgang , UNIX System V Karen S. Fortgang , UNIX System V
(Programmer’s Guide), Prentice-Hall, (Programmer’s Guide), Prentice-Hall, Inc., Englewood Cliffs, NJ 07632, 1987.Inc., Englewood Cliffs, NJ 07632, 1987.
Robin Burk and David B. Horvath, Robin Burk and David B. Horvath, CCP.,et al., UNIX Unreleased Internet CCP.,et al., UNIX Unreleased Internet Edition, Techmedia Monish Plaza, 20, Edition, Techmedia Monish Plaza, 20, Ansari Road, Darya Ganj, New Delhi-2., Ansari Road, Darya Ganj, New Delhi-2., 1998.1998.
[http://nacphy.physics.orst.edu/[http://nacphy.physics.orst.edu/copying-with-unix/node169.html]copying-with-unix/node169.html]