René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

CVS: creating a repository

I wanted to setup a CVS repository. However, searching the net, I was not able to find a tutorial that explained in easy steps how to do that. So, I decided to write one myself.
The following text is a log on how I installed CVS as a server and created a repository.
First, I downloaded the CVS server and client tools for windows from http://www.cvsnt.com/cvspro/.

Installation

The installation turns out to be quite straight forward. Starting the installer takes care of the entire installation.
The default installation installs two windows services: the cvsnt service (named CVSNT) and the cvsnt lock (named CVSNT Locking Service) service. Additionally, it also installs a default certificate.
The cvs.exe was installed into C:\Program Files\cvsnt. To use it more comfortably, this directory needs to be added to the PATH environment variablea.
c:> set PATH=c:\Program Files\cvsnt;%PATH%

Creating a repository

A repository needs a root directory under which both the files under version control and auxiliary files for use by CVS server are stored. I created this directory manually:
C:> mkdir c:\test_repository
However, this is not a CVS repository by itself; the CVS server needs to be told to use this directory as a repository. The CVS server (or service, respectively) is administered through a service control panel that can be invoked in the dos prompt like so:
C:\> cvsnt.cpl
cvsnt.cpl is installed into the system32 directory of windows (%SystemRoot%\system32)
Now, with cvsnt.cpl, one can go to the Repositories tab and add the created repository. I chose /testrep for the name of the repository.
A dialog informed me: C:/test_repository exists, but is not a valid CVS repository.
Do you want to initialise it?

And yes, of course, that's what I wanted.
Then I pressed apply.
The initialization basically created a CVSROOT directory beneath c:\test_repository and put some 55 files and yet another directory into CVSROOT.

Adding a user

After creating the repository, I needed to create a user that can access (that is store and retrieve files) the repository.
C:\>cvs -d:sspi:localhost:/testrep passwd -a some_user
Adding user some_user@localhost
New password: ******
Verify password: ******
cvs server: *WARNING* CVS user 'some_user' will not be able to log in until they are aliased to a valid system user.
The password that I have specified (and is hidden in the console) was geheim.
This command created \test_repository\CVSROOT\passwd with the following content:
some_user:AuC4s3kI8ixcs
Now, some_user needs to be aliased (according to the warning returned by cvs) to a valid system user:
C:\>cvs -d:sspi:localhost:/testrep passwd -r CHSP04\administrator some_user
Changing repository password for some_user@localhost
New password: ******
Verify password: ******
Although this seems a bit redundant, it looks like one has to give the password again.

Creating a module

Now, it was time to create a module which I named test_module:
C:\>mkdir test_module
C:\>cd test_module
For the beginning, I only stored one file, README.txt, into this module.
C:\test_module>notepad README.txt
Here's the content of README.txt:
test_module
===========


This is some dummy text.
C:\test_module>cvs -d:pserver:some_user:geheim@localhost:/testrep import tm no-vendor initial-release
I didn't specify the -m flag, so CVS opened the default editor (as the environment variable CVSEDITOR is not set) to enter a message. I chose the message to be Initial Import:
CVS: ----------------------------------------------------------------------
CVS: Enter Log.  Lines beginning with `CVS:' are removed automatically
CVS: 
CVS: ----------------------------------------------------------------------
Initial Import
.. and CVS answered with:
N tm/README.txt

No conflicts created by this import
The N obviously indicates that tm/README.txt is a new file.
Now, let's see what happened in C:\test_repository.
C:\test_module>cd \test_repository

C:\test_repository>dir
 Volume in drive C has no label.
 Volume Serial Number is EC22-DD8D

 Directory of C:\test_repository

02.11.2004  23:35    <DIR>          .
02.11.2004  23:35    <DIR>          ..
02.11.2004  15:53    <DIR>          CVSROOT
02.11.2004  23:35    <DIR>          tm
Indeed, it added a new directory called tm. What's in there?
C:\test_repository>cd tm

C:\test_repository\tm>dir
 Volume in drive C has no label.
 Volume Serial Number is EC22-DD8D

 Directory of C:\test_repository\tm

02.11.2004  23:35    <DIR>          .
02.11.2004  23:35    <DIR>          ..
02.11.2004  23:35    <DIR>          CVS
02.11.2004  23:35               506 README.txt,v
It contains a CVS directory (again, used for CVS use) and the README.txt (with a ,v suffix)
Now, the repository is ready to be used. Hopefully, I'll have time for another article that shows to actually use the repository.

Update

January 8th 2005: Frank Herrara finds some errors on this page. They're now corrected.