Source Code Control System (SCCS)
=================================
Introduction
~~~~~~~~~~~~
The Source Code Control System (SCCS) is a tool for controlling changes
to text files. It is usually used with source code and documentation
of software systems.
SCCS looks after your files for you. Using it, you can:
o store, update and retrieve any previous version of a text file;
o control who is allowed to update a file;
o identify the version number of a file that has been retrieved;
o record who made each change, when, where and why.
The problem
~~~~~~~~~~~
Why do we need to retrieve previous versions anyway? Software
professionals often need to look at an old version of some software,
perhaps to see whether it too had a bug that has been found in the
latest version. With little files we could keep old versions but there
quickly comes a limit to that. For instance, my `bu' command only
allows five versions to be kept. Clearly, with large files and suites
of files, it would be unworkable to keep separate versions of the whole
system.
The solution
~~~~~~~~~~~~
SCCS solves the problem by keeping only the original file and all the
separate sets of changes that have been made to it. You decide which
version you want and SCCS applies the appropriate sets of changes to
the original file to produce the version you needed.
Since SCCS only looks after text files, it makes use of many of Unix's
text processing tools. Indeed, some of them are not much use without
SCCS. For instance the diff command produces editing commands that can
be used to convert one (earlier) file into another (later) version.
Here is typical output from diff showing the differences between `date'
and `date2':
$ diff date date2
1c1,3
< Wed Mar 29 14:42:19 BST 2000
---
> rhubarb
> Wed March 29 14:42:19 BST 2000
> Wed Mar 29 14:42:40 BST 2000
$
Two level interface
~~~~~~~~~~~~~~~~~~~
SCCS is a complex suite of programs. It can be used most simply with
the `sccs' command; this is an interface to many lower level programs.
Users often simply use the high level interface but sometimes to access
all the power of SCCS, the lower level stuff has to be used.
Starting
~~~~~~~~
Here we set up a one line, dummy C++ program and introduce it to SCCS:
$ date > dummy.C
$ echo 'SCCS ID is %I%' >> dummy.C
$ date >> dummy.C
$ ls
dummy.C
$ sccs create dummy.C
dummy.C:
1.1
3 lines
$ ls -F
,dummy.C SCCS/ dummy.C
$ ls -l
total 6
-rw------- 1 cmsps cms 73 Mar 31 11:21 ,dummy.C
drwx------ 2 cmsps cms 512 Mar 31 11:22 SCCS
-r-------- 1 cmsps cms 73 Mar 31 11:22 dummy.C
$
As you can see, SCCS has created a directory where it keeps its files.
The original file has been made read-only. The `,dummy.C' is a backup
version and we can delete it:
$ rm ,dummy.C
$
Inside the SCCS directory we have:
$ ls -l SCCS
total 2
-r-------- 1 cmsps cms 223 Mar 31 11:22 s.dummy.C
$ more SCCS/s.dummy.C
h12287
s 00003/00000/00000
d D 1.1 00/03/31 11:22:01 cmsps 1 0
c date and time created 00/03/31 11:22:01 by cmsps
e
u
U
f e 0
t
T
I 1
Fri Mar 31 11:21:43 BST 2000
SCCS ID is %I%
Fri Mar 31 11:21:51 BST 2000
E 1
$
The `s.dummy.C' is known as the s-file; it contains the original
version and some housekeeping information. Later it will also contain
all the updates to the file.
Deltas
~~~~~~
Changes to a file in SCCS custody are known as deltas. They have
numbers of the form n.m where n is the release number and m is the
level number. You can see the 1.1 at the start of the s-file.
Now that our file is being looked after by SCCS, we can delete our
version of dummy.C:
$ rm dummy.C
rm: remove `dummy.C', overriding mode 0400? y
$
We can do that because we can get it back from SCCS (along with the
,file) with this:
$ sccs get dummy.C
1.1
3 lines
$ ls -l
total 6
-rw------- 1 cmsps cms 73 Mar 31 11:21 ,dummy.C
drwx------ 2 cmsps cms 512 Mar 31 11:22 SCCS
-r-------- 1 cmsps cms 73 Mar 31 11:25 dummy.C
$
Keywords
~~~~~~~~
Keywords are values that are put into the source file for the sole
purpose of ending up in the executable so that it can tell users its
name and revision number. SCCS inserts the correct values for the
keywords by expanding textual place markers when it recreates the
sources. For instance, `%I%' is replaced with the SCCS delta ID.
Here is the file we just got from SCCS:
$ more dummy.C
Fri Mar 31 11:21:43 BST 2000
SCCS ID is 1.1
Fri Mar 31 11:21:51 BST 2000
$
As you see, the ID has been filled in. If all we wanted to do with the
file was compile it, we could do so and, if were proper C++ or
whatever, the ID would end up in the executable. SCCS can extract all
the keywords from any executable:
$ sccs what /usr/ccs/bin/sccs
/usr/ccs/bin/sccs:
sccs.c 1.2 2/27/90
SunOS 5.6 Generic 02/01/97
$
Getting a file to change it
~~~~~~~~~~~~~~~~~~~~~~~~~~~
The more interesting case arises when we want to edit the file. To do
so we use:
$ sccs edit dummy.C
1.1
new delta 1.2
3 lines
$ ls -l
total 6
-rw------- 1 cmsps cms 73 Mar 31 11:21 ,dummy.C
drwx------ 2 cmsps cms 512 Mar 31 11:36 SCCS
-rw------- 1 cmsps cms 73 Mar 31 11:36 dummy.C
$
Notice that this time, the file is writable. Note also that the delta
has increased.
Only one human editor at once
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SCCS is designed for use by teams of people working on large projects.
Obviously, SCCS would not let another team member (or even the same
one) get the file for editing while it is checked out. Otherwise, one
set of changes would be lost. For example:
$ sccs edit dummy.C
ERROR [SCCS/s.dummy.C]: writable `dummy.C' exists (ge4)
$
SCCS keeps track
~~~~~~~~~~~~~~~~
Because SCCS has to keep track of what is happening, it can tell us
about files being modified:
$ sccs check
dummy.C: being edited: 1.1 1.2 cmsps 00/03/31 11:36:02
$
Other team members can use the command to find who took the module
out to work on it.
Editing
~~~~~~~
We can now edit the file:
$ date >> dummy.C
$
Usually we would make many changes.
How big is a delta?
~~~~~~~~~~~~~~~~~~~
Usually, a delta is many edits. Enough to change the file, correct the
compilation errors, fix the logic errors and get a new, working, tested
version of the module. A delta is not just one edit.
Relinquishing control
~~~~~~~~~~~~~~~~~~~~~
When we have finished with the file, we give it back into SCCS's care:
$ sccs delta dummy.C
comments? All singin', all dancin'
1.2
1 inserted
0 deleted
3 unchanged
$
As you would expect SCCS keeps track of what is happening:
$ sccs info
Nothing being edited
$
Getting an old version
~~~~~~~~~~~~~~~~~~~~~~
Getting an old version is simple, it is done like this:
$ sccs get -r 1.1 dummy.C
1.1
3 lines
$
Checking the history
~~~~~~~~~~~~~~~~~~~~
Checking the modification history is accomplished thus:
$ sccs prt dummy.C
SCCS/s.dummy.C:
D 1.2 00/03/31 11:38:24 cmsps 2 1 00001/00000/00003
All singin', all dancin'
D 1.1 00/03/31 11:22:01 cmsps 1 0 00003/00000/00000
date and time created 00/03/31 11:22:01 by cmsps
$
Examining the differences
~~~~~~~~~~~~~~~~~~~~~~~~~
Getting the differences between the version we have and the latest SCCS
version is fairly simple:
$ sccs diffs dummy.C
------- dummy.C -------
2c2
< SCCS ID is %I%
---
> SCCS ID is 1.1
4d3
< Fri Mar 31 11:38:07 BST 2000
$
Understanding the differences takes a bit of practice!
We can easily look at the changes between two separate versions:
$ sccs sccsdiff -r 1.1 -r 1.2 dummy.C
3a4
> Fri Mar 31 11:38:07 BST 2000
$
And we can use the -m and -p options along with grep to see the lines
added in delta 1.2:
$ sccs get -m -p dummy.C | grep '^1.2'
1.2
4 lines
1.2 Fri Mar 31 11:38:07 BST 2000
$
Project teams
~~~~~~~~~~~~~
As you would expect with a tool of this nature, it works seamlessly
with make and can be networked. Make has built-in rules telling it how
to get the latest version of the source code from SCCS. SCCS also
works seamlessly across a network so that project team members can work
separately but keep one set of source files.
Other facilities
~~~~~~~~~~~~~~~~
You can:
cancel an edit command.
cancel and fix a faulty delta.
"branch" a new version from an old version for an experiment
that needs a more stable base than the current version.
merge a branch back into the "main trunk".
So What?
~~~~~~~~
Properly managed software engineering needs good tools. Modern users
often prefer GUI tools but SCCS is worth knowing as many modern source
code control systems use the same ideas and terminology as SCCS. And
SCCS does work!
分享到:
相关推荐
PB并发控制与Row changed between retrieve and update详解 PB并发控制机制是指在多用户同时访问数据库时,防止数据不一致和丢失的机制。PowerBuilder 提供了多种并发控制策略,包括Key Columns、Key and ...
Query Retrieve SCP Emulator
标题为“an introduction to information retrieve”的文档,实际上是指《信息检索导论》这本书的介绍。该书由斯坦福大学出版,作者包括 Christopher D. Manning、Prabhakar Raghavan 和 Hinrich Schütze。根据描述...
retrieve_data
而"retrieve-maven-artifact-versions"是一个功能,它允许开发者从Maven中央仓库检索特定Maven工件(如JAR、WAR或POM文件)的不同版本。 Maven工件通常由三部分标识:groupId、artifactId和version。例如,`...
标题中的"PyPI 官网下载 | retrieve-0.0.6.tar.gz"指的是Python的包索引(PyPI)上发布的名为`retrieve`的软件包的一个特定版本,即0.0.6版。PyPI是Python开发者发布自己编写的模块、库或工具的地方,方便其他用户...
In order to help mitigate the risk of cross-site scripting, a new feature has been introduced in Microsoft Internet Explorer 6 SP1. This feature is a new attribute for cookies which prevents them from...
We propose a novel Knowledge-driven Encode, Retrieve, Paraphrase (KERP) approach which reconciles traditional knowledge- and retrieval-based methods with modern learning-based methods for accurate ...
retrieve_sqlite_data
Retrieve Form for Data Capture (RFD)
《PyPI官网下载:text-reuse-retrieve-0.1.10.tar.gz——Python库解析与应用》 PyPI(Python Package Index)是Python开发者的重要资源库,它提供了丰富的Python库供全球开发者下载和使用。本文将详细介绍PyPI官网...
标题 "Basic Save and Retrieve Functions" 暗示了这是一个关于在编程环境中保存和恢复数据的基础教程,可能涉及文件操作和程序状态的管理。在描述中没有提供更多的具体信息,但我们可以根据标签 "控件"、"源码"、...
### RLUS:Retrieve Locate Update Service 知识点详解 #### 一、RLUS概述 **RLUS(Retrieve Locate Update Service)**是Healthcare Services Specification Project (HSSP) 在OMG(Object Management Group)...
This module demostrates how to retrieve information about a joystick. This is a great module for game programmers.
使用PL/SQL登录ORACLE数据 报错,error while trying to retrieve text for error ORA-01804,的解决方法,操作步骤,在windows server 2008R2 64位,oracle 12C,PLSQL Developer 12 64位,以上使用环境正常,
首先,"Retrieve HTML pages from the Net" 指的是该控件能够通过HTTP协议从互联网上下载HTML页面内容,这对于构建需要从网页抓取信息或者实现网页浏览功能的应用程序非常有用。这通常涉及到URL请求、HTTP响应处理...
《信息检索技术与应用——基于哈工大研究生课程IR课件解析》 信息检索(Information Retrieval,简称IR)是计算机科学领域中的一个重要分支,它主要研究如何在大量的信息资源中快速、准确地找到用户所需要的信息。...
NX二次开发UF_CUTTER_retrieve 函数介绍,Ufun提供了一系列丰富的 API 函数,可以帮助用户实现自动化、定制化和扩展 NX 软件的功能。无论您是从事机械设计、制造、模具设计、逆向工程、CAE 分析等领域的专业人士,...
该项目是一款基于Python语言的Music Retrieve应用软件设计源码,共包含24个文件,其中Python源代码文件14个,图片文件2个,音频文件2个,以及其他类型的文件如Git忽略文件、Markdown文档、Jupyter笔记本、数据库文件...