The Science of Debugging
Chapter 3


3.2.3 Initalizing CVS


For Unix:

Find the init file for your shell. If you're using bash shell, it's .bashrc, csh and tcsh use .cshrc or .tcshrc, and these are usually located in your home directory. If they're not there, you can usually create them.

In this file, create a new environment variable called 'CVSROOT' and set it equal to the directory you created in step one. I'm using a bash shell, so I edit the file .bashrc and add the following line to the end;

export CVSROOT=/home/cvstutorial/cvsroot



Logout and log back and make sure that the changes took effect by looking at your environmental variables (or just typing echo $CVSROOT).

Now, run the CVS init command :

> cvs init




For Windows

Depending on the version of windows you have, you're going to either need to alter your autoexec.bat file (Win 95/98/ME), or locate the environmental variable applet. I usually use the following path in Windows 2000: Right click on "My Computer" -> choose "Properties" -> select "Advanced Options" -> Click on "Environmental Variables".

Once there, add the variable CVSROOT, and set it equal to the directory your cvs root is in. If you're on a windows 95/98/me machine, your line will read something like this;

set CVSROOT=c:\my\new\cvsrootdir



You'll have to reboot to make your changes actually take effect. The alternative is to manually type this each time you open up a command prompt window, until the next reboot. Windows 2000/NT based OSes can be set with a rather intuitive interface in the environmental variable applet.

Last, open up a new command prompt window (command.com, cmd.exe, etc), and run the command 'cvs init' (though you may have to give an absolute path to 'cvs').

c:\cvs\bin> cvs init





This creates a new, empty CVS repository. Think of CVS like a floppy disk - you've just formatted it. It's a good time to mention that all CVS commands have nearly the same argument/flag setup. In this case, one of the arguments you're not seeing is the directory that is being initialized (It defaults to whatever is in the CVSROOT). You can specify it though, with the -d flag:

> cvs -d /home/cvstutorial/cvsroot init




At least, that's what I'd type on my unix system.

Note that command line arguments always override environmental variables.



Index
3.2.2 CVS Root Directory/A> 3.2.4 Adding Modules to CVS