CS 23 Software Design and Implementation
Lecture 19
Concurrent Versions System (CVS)
In the this lecture we discuss the Concurrent Versions System for managing source code for project
teams.
We also discussed the design of the query engine but no notes are included here. Reason for that is that
the design of the query engine is for you to do as part of Lab6.
Goals
We plan to learn the following from today’s lecture:
- How to manage a large number of source files when different peopel are concurrently working
on them;
- How to use cvs;
- How to import a source tree;
- How to checkout a source tree;
- How to check for changes;
- Updating a file and doing a cvs update;
- Commiting the changes to the cvs; and
- Doing a log and diff agains the local tree and the repository.
Source code control - why you need it
When you move beyond a simple assignment, small code set, and toward large more complex source trees
with multiple people working on the source code in parallel - you need needs to help manage the
code:
1) to manage changes made by the group
2) to avoid conflicting changes
3) to track changes in the code
If you don’t use a source code control tool life can get very complicated so let the software tools
help.
There are a number of source code control tools:
1) SCCS (source code control system)
2) RCS (revision control system)
3) Subversion (newer)
4) CVS (we will use this in the course and project)
My notes are incomplete here - and I apologies. But I want to capture the various scenarios for cvs that I
went over in class. Note, Wayne keeps FAQ on cvs - check it out - but the notes below should be sufficient
for you to manage your cvs account.
The first thing we would like to do is import a source tree for the first time in to my cvs account. Note you
should replace “campbell” in the following with you username.
The import command. We import the lab5 source tree to the cvs under project campbell/indexing
[campbell@moose software]$ cd lab5
[campbell@moose lab5] ls
data README src
[campbell@moose lab5]$ cvs -d campbell@cs23cvs:/cvs import -m "Importing Lab5 to cvs project
indexing" campbell/indexing lab5 start
campbell@cs23cvs’s password:
I campbell/indexing/data/#1#
I campbell/indexing/data/.#1
N campbell/indexing/README
cvs import: Importing /cvs/campbell/indexing/src
cvs import: Importing /cvs/campbell/indexing/src/util
N campbell/indexing/src/util/Makefile
N campbell/indexing/src/util/file_posix.c
N campbell/indexing/src/util/file_test.c
N campbell/indexing/src/util/dictionary.c
N campbell/indexing/src/util/dictionary.h
N campbell/indexing/src/util/file.c
N campbell/indexing/src/util/file.h
N campbell/indexing/src/util/hash.c
N campbell/indexing/src/util/hash.h
N campbell/indexing/src/util/html.c
N campbell/indexing/src/util/html.h
N campbell/indexing/src/util/dictionary_test.c
N campbell/indexing/src/util/header.h
N campbell/indexing/src/util/filetype_test.c
cvs import: Importing /cvs/campbell/indexing/src/index
N campbell/indexing/src/index/Makefile
N campbell/indexing/src/index/index_builder.c
N campbell/indexing/src/index/index_builder.h
N campbell/indexing/src/index/index.dat
N campbell/indexing/src/index/index_test.sh
N campbell/indexing/src/index/buildindex.c
cvs import: Importing /cvs/campbell/indexing/data
N campbell/indexing/data/1
N campbell/indexing/data/2
N campbell/indexing/data/3
N campbell/indexing/data/4
-- snip
N campbell/indexing/data/190
N campbell/indexing/data/191
N campbell/indexing/data/192
No conflicts created by this import
The complete lab5 source tree is now signed in - that is all you have to do for the lab5. Perhaps you
should sign in Lab6 in under project campbell/lab6
OK, lets sign out the complete source tree for the indexing under a different local source directory. We
make a new directory called cvs in our local directory. Then we “checkout” the source tree for lab5 that we
just imported.
[campbell@moose software]$ mkdir cvs
campbell@moose software]$ cd cvs
[campbell@moose cvs] cvs -d campbell@cs23cvs:/cvs checkout campbell/indexing
campbell@cs23cvs’s password:
cvs checkout: Updating campbell/indexing
U campbell/indexing/README
cvs checkout: Updating campbell/indexing/data
U campbell/indexing/data/1
U campbell/indexing/data/10
U campbell/indexing/data/100
-- snip
U campbell/indexing/data/96
U campbell/indexing/data/97
U campbell/indexing/data/98
U campbell/indexing/data/99
cvs checkout: Updating campbell/indexing/src
cvs checkout: Updating campbell/indexing/src/index
U campbell/indexing/src/index/Makefile
U campbell/indexing/src/index/buildindex.c
U campbell/indexing/src/index/index.dat
U campbell/indexing/src/index/index_builder.c
U campbell/indexing/src/index/index_builder.h
U campbell/indexing/src/index/index_test.sh
cvs checkout: Updating campbell/indexing/src/util
U campbell/indexing/src/util/Makefile
U campbell/indexing/src/util/dictionary.c
U campbell/indexing/src/util/dictionary.h
U campbell/indexing/src/util/dictionary_test.c
U campbell/indexing/src/util/file.c
U campbell/indexing/src/util/file.h
U campbell/indexing/src/util/file_posix.c
U campbell/indexing/src/util/file_test.c
U campbell/indexing/src/util/filetype_test.c
U campbell/indexing/src/util/hash.c
U campbell/indexing/src/util/hash.h
U campbell/indexing/src/util/header.h
U campbell/indexing/src/util/html.c
U campbell/indexing/src/util/html.h
Next, we can check the status of our checkout cvs project using “update”. There is nothing
changes no update reflects this. Notice that the source tree is under campbell/indexing off the
cvs directory that was created locally. And not that there is a CVS directory created when
we checkout the source tree. From now on we do not need to specify the complete path “-d
campbell@cs23cvs:/cvs” because that is encoded in the files in the CVS control directory. OK. Let’s
edit index˙builder.c in local directory ../cvs/campbell/indexing/src/index and run update
again. The “M index_builder.c” status indicates that the local version of index_builder.c has
changed.
[campbell@moose cvs] cvs update
campbell@cs23cvs’s password:
cvs update: Updating campbell
cvs update: Updating campbell/indexing
cvs update: Updating campbell/indexing/data
cvs update: Updating campbell/indexing/src
cvs update: Updating campbell/indexing/src/index
cvs update: Updating campbell/indexing/src/util
[campbell@moose cvs] ls
campbell
[campbell@moose cvs]$ cd campbell/
[campbell@moose campbell] ls
CVS indexing
[campbell@moose campbell]$ ls CVS
Entries Entries.Static R
[campbell@moose index] cvs update
campbell@cs23cvs’s password:
cvs update: Updating .
M index_builder.c
OK. Lets lets commit our new changes to index˙builder.c to the repository - for example Alan might need
my new file for his build. When I issue a “cvs commit” I enter into an editor (export CVSEDITOR=emacs
- but this in our bashrc) which is vi by default unless you change it. CVS present a log for you to fill in
-which I write “ Made changes to #include files in index˙builder.c - ATC” and exit and type continue. The
cvs tells me that the <-- index_builder.c index˙build has been committed and has a new version new
revision: 1.2.
[campbell@moose index] cvs commit
cvs commit: Examining .
campbell@cs23cvs’s password:
CVS: ----------------------------------------------------------------------
CVS: Enter Log. Lines beginning with ‘CVS:’ are removed automatically
CVS:
CVS: Committing in .
CVS: Made changes to #include files in index_builder.c - ATC
CVS: Modified Files:
CVS: index_builder.c
CVS: ----------------------------------------------------------------------
Log message unchanged or not specified
a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs
Action: (continue) c
Checking in index_builder.c;
/cvs/campbell/indexing/src/index/index_builder.c,v <-- index_builder.c
new revision: 1.2; previous revision: 1.1
done
Other useful commands are cvs log and cvs diff. Notice that the index˙builder.c status reflects the changes
we have made.
[campbell@moose index] cvs log
campbell@cs23cvs’s password:
cvs log: Logging .
RCS file: /cvs/campbell/indexing/src/index/Makefile,v
Working file: Makefile
head: 1.1
branch: 1.1.1
locks: strict
access list:
symbolic names:
start: 1.1.1.1
lab5: 1.1.1
keyword substitution: kv
total revisions: 2; selected revisions: 2
description:
----------------------------
revision 1.1
date: 2008/02/20 07:40:57; author: campbell; state: Exp;
branches: 1.1.1;
Initial revision
----------------------------
revision 1.1.1.1
date: 2008/02/20 07:40:57; author: campbell; state: Exp; lines: +0 -0
Importing Lab5 to cvs project indexing
=============================================================================
RCS file: /cvs/campbell/indexing/src/index/buildindex.c,v
Working file: buildindex.c
head: 1.1
branch: 1.1.1
locks: strict
access list:
symbolic names:
start: 1.1.1.1
lab5: 1.1.1
keyword substitution: kv
total revisions: 2; selected revisions: 2
description:
----------------------------
revision 1.1
date: 2008/02/20 07:40:58; author: campbell; state: Exp;
branches: 1.1.1;
Initial revision
----------------------------
revision 1.1.1.1
date: 2008/02/20 07:40:58; author: campbell; state: Exp; lines: +0 -0
Importing Lab5 to cvs project indexing
=============================================================================
RCS file: /cvs/campbell/indexing/src/index/index.dat,v
Working file: index.dat
head: 1.1
branch: 1.1.1
locks: strict
access list:
symbolic names:
start: 1.1.1.1
lab5: 1.1.1
keyword substitution: kv
total revisions: 2; selected revisions: 2
description:
----------------------------
revision 1.1
date: 2008/02/20 07:40:58; author: campbell; state: Exp;
branches: 1.1.1;
Initial revision
----------------------------
revision 1.1.1.1
date: 2008/02/20 07:40:58; author: campbell; state: Exp; lines: +0 -0
Importing Lab5 to cvs project indexing
=============================================================================
RCS file: /cvs/campbell/indexing/src/index/index_builder.c,v
Working file: index_builder.c
head: 1.2
branch:
locks: strict
access list:
symbolic names:
start: 1.1.1.1
lab5: 1.1.1
keyword substitution: kv
total revisions: 3; selected revisions: 3
description:
----------------------------
revision 1.2
date: 2008/02/20 08:05:11; author: campbell; state: Exp; lines: +1 -3
Made changes to #include files in index_builder.c - ATC
----------------------------
revision 1.1
date: 2008/02/20 07:40:57; author: campbell; state: Exp;
branches: 1.1.1;
Initial revision
----------------------------
revision 1.1.1.1
date: 2008/02/20 07:40:57; author: campbell; state: Exp; lines: +0 -0
Importing Lab5 to cvs project indexing
=============================================================================
RCS file: /cvs/campbell/indexing/src/index/index_builder.h,v
Working file: index_builder.h
head: 1.1
branch: 1.1.1
locks: strict
access list:
symbolic names:
start: 1.1.1.1
lab5: 1.1.1
keyword substitution: kv
total revisions: 2; selected revisions: 2
description:
----------------------------
revision 1.1
date: 2008/02/20 07:40:57; author: campbell; state: Exp;
branches: 1.1.1;
Initial revision
----------------------------
revision 1.1.1.1
date: 2008/02/20 07:40:57; author: campbell; state: Exp; lines: +0 -0
Importing Lab5 to cvs project indexing
=============================================================================
RCS file: /cvs/campbell/indexing/src/index/index_test.sh,v
Working file: index_test.sh
head: 1.1
branch: 1.1.1
locks: strict
access list:
symbolic names:
start: 1.1.1.1
lab5: 1.1.1
keyword substitution: kv
total revisions: 2; selected revisions: 2
description:
----------------------------
revision 1.1
date: 2008/02/20 07:40:58; author: campbell; state: Exp;
branches: 1.1.1;
Initial revision
----------------------------
revision 1.1.1.1
date: 2008/02/20 07:40:58; author: campbell; state: Exp; lines: +0 -0
Importing Lab5 to cvs project indexing
=============================================================================
Finally, cvs diff is useful for seeing if there is any difference in the tree. No differences are
detected.
[campbell@moose index] cvs diff
campbell@cs23cvs’s password:
cvs diff: Diffing .