Tuesday, April 12, 2005

CVS encounter

Finally started using CVS for my project. Maybe it wont grow as large as I expect, but hey I got to learn a new thing and thats what counts =). So here is a lil tutorial of what I did, so that I can refer later on.

I refered to the following links

1. http://cvsbook.red-bean.com/cvsbook.html#Starting%20A%20Repository
2. http://www.sys-con.com/linux/article.cfm?id=40

What is CVS ? CVS stands for Concurrent Version Control and is used for collaboration and version control.

Most linux distributions (nowdays) come with CVS pre-installed. So all I had to do was start using it. Here is a step by step guide of what I did

1. First one needs a directory where CVS will store the information about the projects that are being version controlled. This is called as a 'repository'. So in short we need to create a repository. The following command was used for it

cvs -d /home/CVSRoot init

So '/home/CVSRoot' is the repository.
I did the following because I was not able to access cvs remotely. So I created a new group called cvs at the server and populated the member list for it. Then I went in /home/CVSRoot and ran the following 2 commands

chgrp -R cvs .
chmod ug+rwx . CVSROOT

2. To make life simpler(lazy me), we can set some environment variables so that the system knows about this repository. I changed the /etc/profile file for this. First make a backup copy in case things go wrong. Then add these two lines in it

export CVSROOT='/home/CVSRoot'
export CVSEDITOR=/bin/vi

So now when I try to add files to my repository, I dont need to specify the CVSROOT explicitly i.e. I dont have to give the complete path name of the repository everytime.

3. Now I was ready to add my project files into it. First go to the directory which contains the files and/or direcotries that you want to add to the repository. I went to /home/rbj2/split_programs. This directory contains all my project files for which I want a version control. Once here, I ran the following command

cvs import split_programs split_tcp start

where split_programs: is the project name by which CVS will create an entry
split_tcp: is a vendor tag. I have o clue what this is :-D

After executing, vi editor gets executed. CVS forces you to write a comment. SO just wrote a random comment. Well it wasnt that random. Anyways, you can supress this by using the -m option. Well, after this command I could see an entry for my project under /home/CVSRoot/.

4. Now I wanted to create remote access so I could store my changes directly from frudo and not have to ftp everytime to turing. So, I start by checking in /etc/services file whether it contains the following line

cvspserver 2401/tcp

It was there. So cool, else I would need to add it in there.
Now go to /etc/xinetd.d. Create a new file called 'cvs'. One can give any name but I choose cvs. And then wrote the following there

#default: on
#description: adding CVS stream for remote CVS access

service cvspserver
{
socket_type=stream
protocol=tcp
wait=no
user=root
disable=no
server=/usr/bin/cvs
server_args= -f --allow-root=/home/CVSRoot pserver
}

Now run the following command

/etc/rc.d/init.d/xinet restart

This will restart xinetd, so our changes will come in effect.

5. But I wanted secure access, so I decided upon having a password authenticated setup. I create a new file 'passwd' in /home/CVSRoot/CVSROOT/. And copy my login info from /etc/shadow. Keep the first two fields and omit everything else. Save and we are ready to go.

6. At frudo, I first create the CVSROOT env variable as

CVSROOT=:pserver:rbj2@turing.internet.lab:/home/CVSRoot

and then to connect I use 'cvs login'
It asks me for my password and boom, I am in.

If I want to checkout the files at frudo, I do 'cvs checkout split_programs'.

3 Comments:

Blogger Punit Raizada said...

I have been thinking of CVS for my work too.. Visual Sourcesafe has been decent enough for me till now but I also wanted to check out CVS.

Is it possible to configure CVS for windows ???

11:31 AM  
Blogger Rahul said...

Have a look at this. Might help.

http://www.wincvs.org/index.html

And kab tak windows windows karte rahoge...time to change to linux :) aaj poker nite ho jaye ?

12:33 PM  
Blogger Punit Raizada said...

Windows... cant live with it but cant live without it....

Ur Right .. Poker night .. I will get the beer ;-)

3:46 PM  

Post a Comment

<< Home