Essays24.com - Term Papers and Free Essays
Search

Cvs

Essay by   •  November 5, 2010  •  1,141 Words (5 Pages)  •  1,265 Views

Essay Preview: Cvs

Report this essay
Page 1 of 5

Introduction to CVS

What is CVS for?

CVS maintains a history of a source tree, in terms of a series of changes. It stamps each change with the time it was made and the user name of the person who made it. Usually, the person provides a bit of text describing why they made the change as well. Given that information, CVS can help developers answer questions like:

* Who made a given change?

* When did they make it?

* Why did they make it?

* What other changes did they make at the same time?

How to use CVS -- First Sketch

Before discussing too many vague terms and concepts, let's look over the essential CVS commands.

Setting your repository

CVS records everyone's changes to a given project in a directory tree called a repository . Before you can use CVS, you need to set the CVSROOT environment variable to the repository's path. Whoever is in charge of your project's configuration management will know what this is; perhaps they've made a global definition for CVSROOT somewhere.

In any case, on our system, the CVS repository is `/u/src/master'. In that case, you would need to enter the commands

setenv CVSROOT /u/src/master

if your shell is csh or one of its descendents, or

CVSROOT=/u/src/master

export CVSROOT

if your shell is Bash or some other Bourne shell variant.

If you forget to do this, CVS will complain when you try to use it:

$ cvs checkout httpc

cvs checkout: No CVSROOT specified! Please use the `-d' option

cvs [checkout aborted]: or set the CVSROOT environment variable.

$

Checking out a working directory

CVS doesn't work on ordinary directory trees; you need to work within a directory that CVS created for you. Just as you check out a book from a library before taking it home to read it, you use the cvs checkout command to get a directory tree from CVS before working on it. For example, suppose you are working on a project named httpc, a trivial HTTP client:

$ cd

$ cvs checkout httpc

cvs checkout: Updating httpc

U httpc/.cvsignore

U httpc/Makefile

U httpc/httpc.c

U httpc/poll-server

$

The command cvs checkout httpc means, "Check out the source tree called httpc from the repository specified by the CVSROOT environment variable."

CVS puts the tree in a subdirectory named `httpc':

$ cd httpc

$ ls -l

total 8

drwxr-xr-x 2 jimb 512 Oct 31 11:04 CVS

-rw-r--r-- 1 jimb 89 Oct 31 10:42 Makefile

-rw-r--r-- 1 jimb 4432 Oct 31 10:45 httpc.c

-rwxr-xr-x 1 jimb 460 Oct 30 10:21 poll-server

Most of these files are your working copies of the httpc sources. However, the subdirectory called `CVS' (at the top) is different. CVS uses it to record extra information about each of the files in that directory, to help it determine what changes you've made since you checked it out.

Making changes to files

Once CVS has created a working directory tree, you can edit, compile and test the files it contains in the usual way -- they're just files.

For example, suppose we try compiling the package we just checked out:

$ make

gcc -g -Wall -lnsl -lsocket httpc.c -o httpc

httpc.c: In function `tcp_connection':

httpc.c:48: warning: passing arg 2 of `connect' from incompatible pointer type

$

It seems that `httpc.c' hasn't been ported to this operating system yet. We need to cast one of the arguments to connect. To fix that, line 48 must change from this:

if (connect (sock, &name, sizeof (name)) >= 0)

to this:

if (connect (sock, (struct sockaddr *) &name, sizeof (name)) >= 0)

Now it should compile:

$ make

gcc -g -Wall -lnsl -lsocket httpc.c -o httpc

$ httpc GET http://www.cyclic.com

... HTML text for Cyclic Software's home page follows ...

$

Merging your changes

Since each developer uses their own working directory, the changes you make to your working directory aren't automatically visible to the other developers on your team. CVS doesn't publish your changes until you're ready. When you're done testing your changes, you must commit them to the repository to make them

...

...

Download as:   txt (6.9 Kb)   pdf (107.3 Kb)   docx (12.3 Kb)  
Continue for 4 more pages »
Only available on Essays24.com
Citation Generator

(2010, 11). Cvs. Essays24.com. Retrieved 11, 2010, from https://www.essays24.com/essay/Cvs/8084.html

"Cvs" Essays24.com. 11 2010. 2010. 11 2010 <https://www.essays24.com/essay/Cvs/8084.html>.

"Cvs." Essays24.com. Essays24.com, 11 2010. Web. 11 2010. <https://www.essays24.com/essay/Cvs/8084.html>.

"Cvs." Essays24.com. 11, 2010. Accessed 11, 2010. https://www.essays24.com/essay/Cvs/8084.html.