CVS
From DreamHost
The Concurrent Versions System (CVS), also known as the Concurrent Versioning System, implements a version control system: it keeps track of all work and all changes in a set of files, typically the implementation of a software project, and allows several (potentially widely separated) developers to collaborate. CVS has become popular in the open-source world. The developers of CVS release it under the GNU General Public License.
Remember also that you can NOT use CVS pserver.
Contents |
Why use CVS?
Without wishing to re-write the CVS manual, you might want to use CVS to hold a copy of your source code of your website, or CGI scripts, or whatever. Rather than just a backup, CVS keeps track of the changes to each file within it, so if you make a mess of something, your older version will still be in CVS.
CVS repository on a server
CVS works by having your files in a single repository, held on a server. Thankfully, you already have that if you are a Dreamhost customer. This repository is simply a directory that you can choose yourself. Once you have set up a repository, you can then "check out" your file(s) to your client machine, as many times as you like.
To create a fresh repository on your Dreamhost server, log in using SSH. Think of a good directory name for your CVS repository to be called, and where you want it; but don't put it within one of your virtual hosts so that people could view it over the web - you can do that using ViewVC which will/might be described later. For the sake of this example, we'll call the CVS repository CVSroot. To create your repository, run this command:
cvs -d $HOME/CVSroot init
The likelihood is that you won't ever need to run that command again. One repository can hold plenty of different projects within it.
Now, once you've run that command, you will have a directory in your home directory ($HOME) called CVSroot. Let's look in there:
mkns@amp:mkns$ ls -l $HOME/CVSroot total 4 drwxrwxr-x 3 mkns xxxxxxxxx 4096 2007-01-23 12:40 CVSROOT
As you will be able to see, there is only one directory, called (potentially confusingly) CVSROOT. Try to ignore that directory for now. You won't need to worry about it until you get on to some real CVS hacking (which I do, but I don't tell others how to for fear they'll break stuff).
CVS from the client side
Next up, we want to create a project on the server. We will want to do this when we have some code or HTML (or whatever you fancy, PNG images, anyone?) that we want to hold in CVS. So, for the sake of this example, let's say you have a web site called example.com with Dreamhost and there are two files in it:
mkns@amp:mkns$ ls -l example.com/ total 0 -rw-r--r-- 1 mkns xxxxxxxxx 11 2007-01-23 12:46 index.html -rw-r--r-- 1 mkns xxxxxxxxx 11 2007-01-23 12:46 table.html
To get this in to your CVS repository, you need to import it. When importing it, you need to tell CVS where your CVS repository is, by using the -d flag. So, it would go something like this:
cd ~/example.com cvs -d $HOME/CVSroot import -m "Importing to CVS" example.com $USER start
The -m flag lets you give it a message when checking it in. If this all works successfully, you'll get some output along these lines:
N example.com/table.html N example.com/index.html No conflicts created by this import
Helpful links
- Dreamhost KB article on CVS
- Dreamhost forum discussion regarding CVS tools
- CVS home page
- Subversion might also be of interest.

