CVS for the developer or amateur
Presented by developerWorks, your source for great tutorials
ibm.com/developerWorks
Table of Contents
If you're viewing this document online, you can click any of the topics below to link directly to that section.
1. Tutorial tips 2
2. CVS for general users 4
3. CVS for developers 10
4. Wrapup 20
CVS for the developer or amateur Page 1
Section 1. Tutorial tips
Should I take this tutorial?
This tutorial introduces readers to CVS, the Concurrent Versions System, used by
developers around the world to develop software in a flexible and collaborative manner.
Intended for those new to CVS, this tutorial will get both general users and new
developers up to speed quickly. Whether you'd like to use CVS to check out the latest
sources of a particular software package, or whether you'd like to begin using CVS as
a full-fledged developer, this tutorial is for you.
Tutorial layout
This tutorial has two parts. The first shows you how to use CVS as a non-developer,
i.e. how to get sources from CVS and keep them updated. The second part introduces
you to using CVS as a developer, showing you how to modify, add and remove files on
CVS and perform other developer-related tasks. If you are new to CVS, it's
recommended that you begin in the first section and proceed to the second section; if
you have some basic CVS experience but are going to be using CVS as a full-fledged
developer for the first time, you should find everything you need in the second section,
but you may want to go through the first section as a review.
Navigation
Navigating through the tutorial is easy:
* Use the Next and Previous buttons to move forward and backward through the
tutorial.
* Use the Main menu button to return to the tutorial menu.
* If you'd like to tell us what you think, use the Feedback button.
Presented by developerWorks, your source for great tutorials
ibm.com/developerWorks
CVS for the developer or amateur Page 2
Getting help
For technical questions about the content of this tutorial, contact the author, Daniel
Robbins, at drobbins@gentoo.org .
Residing in Albuquerque, New Mexico, Daniel Robbins is the President/CEO of Gentoo
Technologies, Inc., the creator of Gentoo Linux , an advanced Linux for the PC, and
the Portage system, a next-generation ports system for Linux. He has also served as
a contributing author for the Macmillan books Caldera OpenLinux Unleashed, SuSE
Linux Unleashed, and Samba Unleashed. Daniel has been involved with computers in
some fashion since the second grade, when he was first exposed to the Logo
programming language as well as a potentially dangerous dose of Pac Man. This
probably explains why he has since served as a Lead Graphic Artist at SONY
Electronic Publishing/Psygnosis. Daniel enjoys spending time with his wife, Mary,
and his new baby daughter, Hadassah.
Presented by developerWorks, your source for great tutorials
ibm.com/developerWorks
CVS for the developer or amateur Page 3
Section 2. CVS for general users
What is CVS and what does it do?
CVS is a client/server system allowing developers to store their projects in a central
location, called a repository. Using the cvs client tools, developers can make changes
to the contents of the repository. In turn, the cvs repository tracks every change made
to every file, creating a complete history of the evolution of the development project.
Developers can request older versions of a particular source file, view a log of
changes, and perform other useful tasks as needed.
The role of CVS
A lot of open software projects have their own CVS servers, which are used by the
project developers as a central repository for all their work. Developers often make
improvements to the sources in the CVS repository on a daily basis; and often, these
developers are scattered around the world, yet CVS provides the necessary
mechanism to unite their project into a centralized, cohesive whole. CVS creates the
"organizational glue" that allows these developers to make improvements to the code
without stepping on each other's toes, losing important data or missing each other's
critical updates to particular source files.
CVS -- the latest developer sources
When the developers are ready, they'll roll some their current work on CVS into a
.tar.gz file and release it as a new official version of their software package. However,
the latest official release sometimes isn't recent enough, for a variety of possible
reasons. In the first section of this tutorial, I'll show you how to use CVS for this
purpose -- acquiring the latest and greatest developer version of the sources for your
own personal use.
Presented by developerWorks, your source for great tutorials
ibm.com/developerWorks
CVS for the developer or amateur Page 4
CVS -- do you have it?
Before you can actually use CVS, you need to get it installed on your system. The
easiest way to test to see if it's installed is to type:
# cvs
If a cvs command is found, then you've got it! Otherwise, you'll need to either track
down a binary package for your particular distribution, or install it from sources.
Installing CVS from sources is actually quite simple, and I'll show you how in the next
panel.
Installing CVS from sources
Installing CVS from sources is easy. First, grab the cvs-1.11.tar.gz tarball from
ftp://ftp.cvshome.org/pub/cvs-1.11/cvs-1.11.tar.gz (if there's a newer version listed
here , you might as well grab the new one instead.) Then perform the following steps
(command output has been omitted for brevity):
# tar xzvf cvs-1.11.tar.gz
# cd cvs-1.11
# ./configure
# make
# make install
Now you should be ready to go.
The CVSROOT
Before we begin, there are a few CVS fundamentals that you need to know. The first is
that in order to connect to a CVS repository, you first need to know a path called the
"CVSROOT". The CVSROOT is a string, like a URL, that tells the cvs command where
the remote repository is and how we'd like to connect to it. Just to make things
interesting, CVS has a number of CVSROOT formats, depending on whether the CVS
repository is local or remote and what method you're going to use to connect to it. Here
are some example CVSROOTs, along with explanations...
Presented by developerWorks, your source for great tutorials
ibm.com/developerWorks
CVS for the developer or amateur Page 5