Using CVS

<texit>\index{CVS}</texit> In this chapter you'll get an overview of the CVS-structure we're using for our software-radio. It is assumed that you already worked sometimes with CVS and that you know about the basic ideas and advantages of CVS.

CVS stands for Concurrent Versioning System, and is the most widespread used tool to make sure that a group of developers can access the code at the same time without creating havoc. While it has some disadvantages, it is a well-tested, stable tool that does its job right.

The first section talks about the structure used, while the other sections talk about how to use the CVS with this structure.

Structure

Usually one has a structure with one primary Branch where all developers commit their changes to. In our case this was not desired, as sometimes a developer changes huge structures during their work, and while the changes last, the code is unstable. Furthermore the code has to run on more than one machine at the same time, while needing localized compiling under root. This made it impossible to have a shared directory on all machines. So, what we need is:

  • Seperate Development by giving each developer an own Branch
  • Distributing of the new code using CVS-command 'up'
  • Easy merging through the CVS-command 'join'

The first two points are easily done in CVS. You can create branches, check them out, and then work in these quite comfortably. The difficulty arises when one tries to merge the changes back into the main-branch, perhaps even from different developers.

Here is an overview about what is happening in a case when we want to synch two branches, called Main and Nicou. “a”, “b” and “c” are the original versions of three files, while “b'” and “c'” are modified versions of these files. “d” and “e” are new files that have been added later.

The 'server'-column displays what is stored on the cvs-server, that is, whenever you call “cvs commit”, your 'local' changes are stored on the server, and with “cvs update”, the changes stored in 'server' are written to 'local'.

Main Nicou
server local server local
a b c a b c a b c a b c
tag: lswN tag: lswM

Both Main and Nicou start synchronized. They have a tag called lswN for the Main-Branch and lswM for the Nicou-Branch. Now both work in their respective Branch and check in their changes, and we get the following picture:

a b' c d a b' c d a b c' e a b c' e

The tag is still with the first version, that is “a b c”. Now let's get the changes from Main to Nicou:

SRadio.Nicou> Conventions/synch

By taking the difference between lswN and what is actually stored in the Main-Branch, we get this:

a b' c d a b' c d a b c' e a b' c' d e

Now it is very important not to commit these changes, because first we need to take everything that has been changed in the Nicou-Branch to the Main-Branch:

SRadio.Main> Conventions/synch

And we get:

a b' c d a b' c' d e a b c' e a b' c' d e

Now we can commit on both sides, writing the changes from 'local' to the 'server'. Then, we update the tags:

SRadio.Nicou> Conventions/tag

and finally we get this picture:

a b' c' d e a b' c' d e a b' c' d e a b' c' d e
tag: lswN tag: lswM

Now we can start again with changing in both branches.

Starting a new Branch

There are two things to do when starting a new branch: first the new branch has to be created, then the appropriate tags have to be written to the cvs-tree.

Let's say we want to create a new branch called 'Brian'. For the first part, it is enough to write in a checked-out Main-branch the following line:

SRadio.Main> cvs tag -b Branch_Brian

Then we have to make sure that everything is correctly tagged:

SRadio.Main> Conventions/tag Brian

This is all that is needed. Now you can proceed to <ref>sec:cvs_first_checkout</ref> to see how to set up the system for the new user.

Checking Out for the First Time

It is a good idea to have the following set-up if you're not familiar with CVS:

brian@radio1: > echo "export CVS_RSH=ssh" >>  /.bashrc
brian@radio1: > echo -e "cvs -q\nup -dP \ncommit -m ''" > /.cvsrc

Then you have to log out and log in again, so that these parameters are available to your bash-shell. These commands help in everyday cvs. It might also be more comfortable to run the tool SRadio.Brian/Conventions/lussh and follow it's directions to create a password-less login to user 'sradio' on lcmpc10.epfl.ch.

Now we can actually check-out a version of this new branch. For this, change into the home-directory of brian, and write this:

brian@radio1: > cvs -d sradio@lcmpc10.epfl.ch:/home/sradio/cvs co -r
Branch_Brian SRadio
brian@radio1: > mv SRadio SRadio.Brian

This gives you a check-out of the branch Brian in the directory SRadio.Brian. All changes that are done in this directory are kept seperate from the other parts of the software-radio, so you can commit and update at will, without disturbing other developers.

Last modified:: %2007/%02/%20 %10:%Feb