A somewhat usage guide to development with CVS

What is CVS:

CVS is a version control system, which allows you to keep old versions of files (usually source code), keep a log of who, when, and why changes occurred, etc., like RCS or SCCS. Unlike the simpler systems, CVS does not just oper- ate on one file at a time or one directory at a time, but operates on hierarchical collections of directories con- sisting of version controlled files. CVS helps to manage releases and to control the concurrent editing of source files among multiple authors. CVS allows triggers to enable/log/control various operations and works well over a wide area network. cvs keeps a single copy of the master sources. This copy is called the source ``repository''; it contains all the information to permit extracting previous software releases at any time based on either a symbolic revision tag, or a date in the past.

A little guide:

Here is a little cvs usage guide.

<get it>
The concept of cvs, the very core of cvs - is that multiple people can work on the same project - even the same file at the same time. This makes it possible for developers accross the globe working together on a project.
</get it>

In this example, we will assume that you have shell access to the box, with the repository. We will also assume that you have write access to the repository.

Basically how it works is, that you have "master" version of your project. (Your project can be an HTML site, or a C development project, etc etc). The "master" version is located in the repository (in our case: /space1/cvsrep) - and every time you wish to work on the project, you will have to checkout a "working copy". Here is how to checkout a "working copy"

Make a dir in your homedir, where you want to checkout projects.

root@svin~# mkdir projects

To checkout a working copy of a given project (fx. the wapsite) - do as follows:

root@svin~/projects# cvs -d /space1/cvsrep checkout wap_www

NOTE: To skip the "-d /space1/cvsrep" every time you use the cvs command, export a env variable called $CVSROOT=/space1/cvsrep

A subdirectory will be created within the projetcs dir, called wap_www.

You can now work as you wish on the files, and when you are finished, you will have to commit your work.

root@svin~/projects# cd wap_www
root@svin~/projects/wap_www# [vim a bunch of stuff]

Now we want to commit it:
Assuming you have set the ENV var $CVSROOT)

root@svin~/projects/wap_www# cvs commit

Your fav. editor will popup, and ask you to type in a log message for the commit, afterwards you save & quit yor editor and the commit will be done.

(If someone has been working on the same files, while you have, and comitted before you - you might expirience conflicts - that you will have to resolve (man cvs) hint: cvs diff -c)

That is it !!! You have made your first commit.

--

Let's say a month has passed by, and you need to add some more code to the wap project. Other people have probably added/removed code on the project meanwhile. So to merge new code from the repository to your working copy is done as follows:

root@svin~/projects/wap_www# cvs update

It always a good idea to run "cvs update" before working on a project.

Other interesting commands includes:

cvs diff -c
cvs log
cvs status {file}

NOTE: When committing binary or graph files, you need to disable line-convert and Keyword expansion. (read: man cvs)


Michael L. Hostbaek

$Id: cvs.html,v 1.7 2001/12/07 14:36:36 mich Exp $