This talk was first given by Curt Sampson at the November 16th, 1998 meeting of the Vancouver Linux Users' Group.

 

CVS – An Aid to
Software Configuration Management
Under Unix

 

I. Revision Control with RCS

RCS – Revision Control System

What does RCS do?

 

RCS – Check-in

$ ls
file1

$ ci file1
file1,v <-- file1
enter description, terminated with single '.' or end of file:
NOTE: This is NOT the log message!
>> The first file.
>> .
initial revision: 1.1
done

$ ls
file1,v

RCS – Check-out

$ ls
file1,v

$ co file1
file1,v --> file1
revision 1.1
done

$ ls –l
total 2
-r--r--r-- 1 cjs staff 85 Nov 14 19:14 file1
-r--r--r-- 1 cjs staff 275 Nov 14 19:14 file1,v

$ chmod +w file1; vi file1
...
$ ci file1
file1,v <-- file1
ci: file1,v: no lock set by cjs

$ rcs –l file1
RCS file: file1,v
1.1 locked
done

$ ci –l file1
file1,v <-- file1
new revision: 1.2; previous revision: 1.1
enter log message, terminated with single '.' or end of file:
>> Added another line.
>> .
done

$ ls –l
total 2
-rw-r--r-- 1 cjs staff 127 Nov 14 19:15 file1
-r--r--r-- 1 cjs staff 435 Nov 14 19:29 file1,v

 

RCS – Logs

$ rlog file1

RCS file: file1,v
Working file: file1
head: 1.2
branch:
locks: strict
cjs: 1.2
access list:
symbolic names:
keyword substitution: kv
total revisions: 2; selected revisions: 2
description:
The first file.
----------------------------
revision 1.2 locked by: cjs;
date: 1998/11/15 03:29:14; author: cjs; state: Exp; lines: +1 –0
Added another line.
----------------------------
revision 1.1
date: 1998/11/15 03:14:43; author: cjs; state: Exp;
Initial revision
===================================================================

 

RCS – Check-out of Other Revisions

$ co –r1.1 file1
file1,v --> file1
revision 1.1
done

$ rcs -nfoo:1.2 file1
RCS file: file1,v
done

$ co -l -rfoo file1
file1,v --> file1
revision 1.2
done

$ rlog file1
...
symbolic names:
foo: 1.2
...

$ rcs -nfoo:1.3 file1
RCS file: file1,v
done

$ rcs -nfoo:1.1 file2
RCS file: file2,v
done

$ co -rfoo file1 file2
file1,v --> file1
revision 1.3
done
file2,v --> file2
revision 1.1
done

 

RCS – Comparing Revisions

$ rcsdiff -r1.1 -r1.2 file1
===================================================================
RCS file: file1,v
retrieving revision 1.1
retrieving revision 1.2
diff -r1.1 -r1.2
2a3
> This is the third line of the first file.

cynic $ rcsdiff -u -r1.1 -r1.2 file1
===================================================================
RCS file: file1,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- file1 1998/11/15 03:14:43 1.1
+++ file1 1998/11/15 03:29:14 1.2
@@ -1,2 +1,3 @@
This is the first line of the first file.
This is the second line of the first file.
+This is the third line of the first file.

 

RCS – Identification

$ cat file1
$Id: CVSpres.html 319 2001-11-07 06:23:15Z cjs $
This is the first line of the first file.
This is the second line of the first file.
This is the third line of the first file.

$ ci -u file1
file1,v <-- file1
new revision: 1.3; previous revision: 1.2
enter log message, terminated with single '.' or end of file:
>> Added ID string.
>> .
done

$ cat file1
$Id: CVSpres.html 319 2001-11-07 06:23:15Z cjs $
This is the first line of the first file.
This is the second line of the first file.
This is the third line of the first file.

$ ident /usr/bin/dig
/usr/bin/dig:
$NetBSD: crt0.c,v 1.28 1997/10/20 13:49:45 mycroft Exp $
$Id: CVSpres.html 319 2001-11-07 06:23:15Z cjs $
$Id: CVSpres.html 319 2001-11-07 06:23:15Z cjs $
$Id: CVSpres.html 319 2001-11-07 06:23:15Z cjs $
$Id: CVSpres.html 319 2001-11-07 06:23:15Z cjs $
$Id: CVSpres.html 319 2001-11-07 06:23:15Z cjs $
$Id: CVSpres.html 319 2001-11-07 06:23:15Z cjs $
[etc.]

 

RCS – Branches

$ co -l -r1.2 file1
file1,v --> file1
revision 1.2 (locked)
done
$ vi file1
...

$ ci -u file1
file1,v <-- file1
new revision: 1.2.1.1; previous revision: 1.2
enter log message, terminated with single '.' or end of file:
>> Add ID string at end.
>> .
done

1.3 1.2.1.1
| |
1.2 ------+
|
1.1

1.6 1.2.1.4 1.2.1.3.1.1
| | |
1.5 1.2.1.3 --------+ 1.2.1.1.1.2
| | |
1.3.1.1 1.4 1.2.1.2 1.2.1.1.1.1
| | | |
+------1.3 1.2.1.1 ---------------------+
| |
1.2 ------+
|
1.1

$ co –r1.2.1 file1
file1,v --> file1
revision 1.2.1.4
done

$ rcs –ncjstest:1.2.1
$ rcs –nrcctest:1.2.1.1.1

 

RCS – Merging Revisions

$ co -l -r1.3 file1
file1,v --> file1
revision 1.3 (locked)
done

$ cat file1
$Id: CVSpres.html 319 2001-11-07 06:23:15Z cjs $
This is the first line of the first file.
This is the second line of the first file.
This is the third line of the first file.

$ rcsdiff -u -r1.2 -r1.2.1.1 file1
===================================================================
RCS file: file1,v
retrieving revision 1.2
retrieving revision 1.2.1.1
diff -u -r1.2 -r1.2.1.1
--- file1 1998/11/15 03:29:14 1.2
+++ file1 1998/11/16 08:23:53 1.2.1.1
@@ -1,3 +1,4 @@
This is the first line of the first file.
This is the second line of the first file.
This is the third line of the first file.
+$Id: CVSpres.html 319 2001-11-07 06:23:15Z cjs $

$ rcsmerge -r1.2 -r1.2.1.1 file1
RCS file: file1,v
retrieving revision 1.2
retrieving revision 1.2.1.1
Merging differences between 1.2 and 1.2.1.1 into file1

$ cat file1
$Id: CVSpres.html 319 2001-11-07 06:23:15Z cjs $
This is the first line of the first file.
This is the second line of the first file.
This is the third line of the first file.
$Id: CVSpres.html 319 2001-11-07 06:23:15Z cjs $

<<<<<<< file1
Line 2
=======
Line the second
>>>>>>> 1.1.1.1

 

RCS – Multiple Users and Workspaces

$ cd ~rcc/work
$ co -u ~cjs/source/thisprog/file1,v ~cjs/source/thisprog/file2,v
../a/file1,v --> file1
revision 1.3 (unlocked)
done
../a/file2,v --> file2
revision 1.1 (unlocked)
done

$ rcsdiff -r1.1 -r1.2 file1
rcsdiff: RCS/file1,v: No such file or directory

$ rcsdiff -r1.1 -r1.2 ~cjs/source/thisprog/file1,v
=========================================================
RCS file: /home/cjs/source/thisprog/file1,v
retrieving revision 1.1
retrieving revision 1.2
diff -r1.1 -r1.2
2a3
> This is the third line of the first file.

 

RCS – More than Just Source Code

RCS – Problems

 

II. Revision Control with CVS

CVS – Concurrent Versions System

CVS – Based on RCS

 

 

CVS – Initialising the Repository

$ export CVSROOT=/home/cjs/cvsroot
$ cvs init

$ cvs import -m "Initial import." mytree vendor release_1
N mytree/file1
N mytree/file2
cvs import: Importing /home/cjs/work/cvs-pres/cvsroot/mytree/one
N mytree/one/file3
N mytree/one/file4
cvs import: Importing /home/cjs/work/cvs-pres/cvsroot/mytree/two
N mytree/two/file5

No conflicts created by this import

 

CVS – Checking Out and Updating Modules

$ cvs co mytree
cvs checkout: Updating mytree
U mytree/file1
U mytree/file2
cvs checkout: Updating mytree/one
U mytree/one/file3
U mytree/one/file4
cvs checkout: Updating mytree/two
U mytree/two/file5

$ cd mytree
$ ls –CF
CVS/ file1 file2 one/ two/

$ cvs update
cvs update: Updating .
U file1
P file2
cvs update: Updating one
cvs update: Updating two

 

CVS – Making and Checking In Changes

$ cvs update
cvs update: Updating .
M file2

$ cvs commit -m "my changes"
cvs commit: Examining .
Checking in file2;
/home/cjs/work/cvs-pres/cvsroot/mytree/file2,v <-- file2
new revision: 1.2; previous revision: 1.1
done

CVS – Commands

 

CVS – Branches

CVS – Importing Vendor Sources

 

CVS – Checks and Logging

CVS – Driving Open Source

CVS – More Than Just Source Code

 

III. Configuration Management

 

IV. Further Information

Other Revision Control Systems

Other SCM Tools

Web Sites and Books