Tag Archives: Howto

Learning to use CVS.

Reason for using cvs:

CVS is a tool to organize source-code in development. It allows you to revert to earlier code based on date or versions, but it also allows multiple people to work on the code.

As root:

emerge -av cvs
mkdir /var/cvsroot
export CVSROOT=/var/cvsroot
cvs init
groupadd cvs
chmod -R g+srw /var/cvsroot
chown -R root:cvs /var/cvsroot

First step was install cvs on on my server which is Gentoo based. Then create the cvs root directory. As cvs is not really server based, you need to make sure if know where the repository is located. This is done by exporting the CVSROOT environmental variable. Then you have to initialize the CVSROOT. At this point I created a cvs group to allow users in that group to use the repository.

As a cvs user.

mkdir ~/public_html
cd ~/public_html
cvs import -m "test" public_html vtag start
vim index.php
csv add index.php
csv commit -m "Adding new files"

In this case I am testing with my user web directory. So I create the directory and then move into it. Now its time to create the repository. The ‘-m “test”‘ is a comment and if you don’t include it cvs will fire up your default editor so you can add it. I made the name of this repository “public_html” as that is the name of the folder. The vtag is the vendor tag, you can set it to anything you want, but I think you have to have it, beyond that I am not sure what it is used for. Now you can start creating your files. Once you have done this, you can add your new files to the repository with two commands. The “cvs add” command tells cvs you want to add the file, then “cvs commit” will actually add the file to the repository.

cvs checkout

If you have multiple people working on your code you want to do a “cvs checkout” to make sure your copy is up to date with any changes the other users have committed.