This talk was first given by Curt Sampsonat 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
,v
, which contains all of the revisions of that file that have ever existed.
$ 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
co
command to check out a copy in order to examine it.
$ 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
co l
. Since we didn't do that, we can lock our current unlocked check-out with rcs l
.
$ rcs l file1
RCS file: file1,v
1.1 locked
done
ci
to check out a locked or unlocked copy of the file after the check-in by using the l
or u
options, respectively.
$ 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
command shows information on the revision set.
$ 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
r
option with co
.
$ co r1.1 file1
file1,v --> file1
revision 1.1
done
rcs n
.
$ 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
command. This is very similar to the standard Unix diff
command, and takes many of the same arguments.
$ 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
$Keyword$
keywords. This information can include
$ 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.
$Id: CVSpres.html 319 2001-11-07 06:23:15Z cjs $
string is called keyword substitution. It can be turned off for binary files.char *version = "$Id: CVSpres.html 319 2001-11-07 06:23:15Z cjs $";
ident
command examine the binary files to see which versions of which source files are in it.
$ 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
/etc
and elsewhere when multiple sysadmins are maintaining systems.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
/cvsroot
) or a remote one (cvs.netbsd.org:/cvsroot
). If remote, it will use rsh or the program specified by CVS_RSH.
$ 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 log
: show the RCS logs of a file.cvs diff
: show differences between revisions, or between current copy and repository copycvs tag
: assign a symbolic name to a set of revisions.cvs co rrev or cvs update r
rev
: check out specific versions of filescvs commit
: commit changes (check-in)cvs update jX.X jX.X
: merge revisions.cvs admin
: execute RCS commands.cvs import
: Import files to vendor branch.cvs update
: bring checked-out files up to date.cvs add
: Add a file to the repository.cvs remove
: `remove' a file from the repositorycvs status
: show current checked out revision and status of it.cvs annotate
: show who wrote each line.cvs history
: show repository access history
CVS Branches
cvs rtag b netbsd-1-3 src
cvs update rnetbsd-1-3
cvs rtag netbsd-1-3-BETA src
cvs rtag netbsd-1-3-RELEASE src
cvs rtag netbsd-1-3-PATCH01 src
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
http://www.mozilla.org/tools.html
.Web Sites and Books
http://www.loria.fr/~molli/
make
)http://www.loria.fr/~molli/cvs-index.html
http://www.perforce.com/