Knowledge Base/Tools/CVS
From Quantitative Finance
Setting up a new CVS repository on UNIX
Ask your administrator to create a new CVS repository. Once this is done, configure your user profile file as follows.
Add the following lines to the end of your user profile file (.profile on Bourne shell; .bash_profile on Bourne Again SHell, .cshrc on C shell, .profile on Korn shell, .tcshrc on TC shell, .zshrc on Z shell):
Bourne, Bourne Again, Korn shell users:
CVSROOT=:pserver:${LOGNAME}@<host>:<repository path>
export CVSROOT
cvs () { <cvs path> "$@"; }
Other shell users:
setenv CVSROOT :pserver:${LOGNAME}@<host>:<repository path>
alias cvs <cvs path>
Creating a new CVS project
First, select a location for your development shadow directory. I normally use ~/dev. Create it if it doesn't exist.
If you haven't already logged into CVS, do so now:
cvs login
CVS will prompt you for your password.
Inside the shadow directory, create a project directory. I like to group related projects into logical meta-projects. Suppose the meta-project is called "misc" and the project is called "test":
mkdir ~/dev/misc mkdir ~/dev/misc/test
Go to the project directory:
cd ~/dev/misc/test
If you already have some existing project files, copy them to ~/dev/misc/test. If not, simply carry on.
Execute CVS import:
cvs import -m "Imported new project" misc/test pbilokon start
"Imported new project" is simply a log message. misc/test tells CVS where in the repository the files in the current directory should go, thus they will be placed under <repository>/misc/test. The fact that the current directory is also called ~/dev/misc/test is a "coincidence"; it doesn't really matter where you put the files within your local shadow (but it helps to be organised).
pbilokon is a vendor tag and start is a release tag. CVS requires you to specify them.
If the CVS import succeeds, you will see the following:
No conflicts created by this import
The files have been copied to the repository; you can delete the project directory if you want:
cd ~/dev rm -r ~/dev/misc/test
Now you can check them out from the repository:
cd ~/dev cvs checkout misc/test
CVS will re-create ~/dev/misc/test and put the project files under that directory.
Note
If you don't like the idea of grouping projects into meta-projects, you can omit "misc" in the explanation above.
