VCS::CVS

Table of contents

VCS::CVS
CVS under MS Windows
Downloading CVS for NT
Installing and configuring CVS for NT
Importing a module, manually
Warning: Binary files ahead
Testing importing
Trap # 1 - Editing the wrong files
Editing a real file
Resources
Alternatives to VCS::CVS
Author
Licence

VCS::CVS

This is a pure Perl module I wrote which provides a Perl interface to the CVS client.

CVS under MS Windows

This document is a simple introduction to running both a CVS client and a CVS server under Windows.

This is for when you wish to administer CVS yourself, and for using VCS::CVS.

I discuss installing the most recent stable version of CVS for NT because I refuse to install beta software.

I assume you want to start with a minimal system, which means not worrying about web, email and newsgroup servers, nor GUI-based cvs clients.

Downloading CVS for NT

At http://www.cvsnt.org/ there is a file cvsnt_1.11.1.3.exe (3,342,042 bytes) which is a cvs server. I'm running this.

Installing and configuring CVS for NT

I log on to WinNT as Administrator, and will be running all Perl scripts under the same account. This means the cvs client will always be run by Administrator.

I do not want CVS to accept connections from anyone on the internet, so the TCP/IP option in the server is disabled. See below.

Decide where your repositories will repose

I use e:\Repository. A simple name means it is simple to back up.

This directory will contain a number of sub-directories. One will be called CVSROOT, and there will be one for each module you import into CVS.

Create e:\Repository
In your environment, set HOME = d:\

Or wherever. I have not worked out why CVS for NT needs this, since $HOME/.passwd is not used.

In your environment, set CVSROOT = :pserver:localhost:e:/Repository
The environment variable CVSEDITOR

I could not get this to work after trying quite a few variations, so forget it.

Run cvsnt_1.11.1.3.exe

Install it into, say, d:\Program Files\CVS for NT.

Exit from RegEdt32
Go to Start/Settings/Control Panel/CVS for NT, and double-click on the green fish

I guess it's better than a purple turkey...

The window says CVS NT Service 1.11.1.3 rc1 (Build 53).

Click on Repositories/Add
Enter e:/Repository and click OK
Click on Advanced
Check that the checkboxes are like this:
[x] Listen in TCP/IP port
[x] Listen on named pipe
[x] Impersonation enabled
[ ] Use local users instead of domain
Click on Apply
Click on Server Status/Install
Click on Server Status/Start

A moment later the Stop button will become clickable.

At a DOS prompt type 'cvs -v'

The client should connect to the server, and output

Concurrent Versions System (CVSNT) 1.11.1.3 rc1 (Build 53) (client/server)

followed by 7 lines of other stuff.

We're up and running!

Importing a module, manually

Firstly decide where you are going to work.

I use e:\Sandbox.

We need to test CVS by doing this:

Import some code
Check it out
Edit it
Commit it
Run a diff

So here we go.

We'll do all this manually at first, just to ensure it works.

Later we'll replicate it with a Perl program.

Warning: Binary files ahead

But wait!

By default, CVS corrupts binary files. This really pisses me off.

So, restrict yourself to text files until you've studied this problem.

Testing importing

Create a small directory structure, containing just text
        shell>e:
        shell>cd \
        shell>cd sandbox
        shell>md apache
        shell>cd apache
        shell>md cgi-bin
        shell>md htdocs
        shell>copy d:\apache\cgi-bin\env.cgi apache\cgi-bin
        shell>copy d:\apache\htdocs\index.html apache\htdocs
Add the apache module to CVS
        shell>e:
        shell>cd \sandbox\apache
        shell>cvs import -m "Initial version" apache start-tag vendor-tag

        Your output should look like:
        cvs import: Importing e:/Repository/apache/cgi-bin
        N apache/cgi-bin/env.cgi
        cvs import: Importing e:/Repository/apache/htdocs
        N apache/htdocs/index.html

        No conflicts created by this import

        Notice how we had to be in sandbox\apache to do this.
Run diff to validate the import

We do this by checking out the apache module into a slightly different directory and running diff.

        shell>cd \sandbox
        shell>md test
        shell>cd test
        shell>cvs checkout apache

        Your output should look like:
        cvs checkout: Updating apache
        cvs checkout: Updating apache/cgi-bin
        U apache/cgi-bin/env.cgi
        cvs checkout: Updating apache/htdocs
        U apache/htdocs/index.html

        shell>diff -rs \sandbox\apache \sandbox\test\apache

        Notice we are not using the 'cvs diff' command yet, but
        rather are running the GNU for DOS diff. See:
        http://savage.net.au/Ron/GNU-Utils.html for downloading help.

        The -r option means recursive. The -s option means report identical files.

        Your output should look like:
        Only in \sandbox\test\apache: CVS
        Only in \sandbox\test\apache/cgi-bin: CVS
        Files \sandbox\apache/cgi-bin/env.cgi and
                \sandbox\test\apache/cgi-bin/env.cgi are identical
        Only in \sandbox\test\apache/htdocs: CVS
        Files \sandbox\apache/htdocs/index.html and
                \sandbox\test\apache/htdocs/index.html are identical

By this time, you're laughing (hysterically).

Trap # 1 - Editing the wrong files

It's easy to import a module and then start editing it. But the copy you've just imported is not the copy you want to be editing.

You must run cvs to checkout a new copy, and edit that copy.

So that's what we turn to next.

Editing a real file

Time to edit a file, check it in, and run 'cvs diff'.

Clean up previous tests and check out the apache module again
        shell>e:
        shell>cd \sandbox
        shell>rd /q /s apache

        Notice how we can wipe out the previously imported
        apache module now that we have faith in CVS.

        shell>rd /q /s test
        shell>cvs checkout apache
Edit \sandbox\apache\cgi-bin\env.cgi

Do something distinctive. If we assume lines 1 .. 4 contain comments, then add these lines after line 5:

        #
        # Author:
        #<tab>Ron Savage.
Check this edit back in
        shell>cd \sandbox\apache\cgi-bin
        shell>cvs commit -m "Added author" env.cgi

        Your output should look like:
        Checking in env.cgi;
        e:/Repository/apache/cgi-bin/env.cgi,v  <--  env.cgi
        new revision: 1.2; previous revision: 1.1
        done

        Notice how we were in apache\cgi-bin to do this. Actually, this would work too:

        shell>cd \sandbox\apache
        shell>cvs commit -m "Added author" cgi-bin\env.cgi
Run cvs diff
        shell>cvs diff -r1.1 -r1.2 env.cgi

        Your output should look like:
        Index: env.cgi
        ===================================================================
        RCS file: e:/Repository/apache/cgi-bin/env.cgi,v
        retrieving revision 1.1
        retrieving revision 1.2
        diff -r1.1 -r1.2
        4a5,7
        > #
        > # Author:
        > #     Ron Savage.

It works!

Resources

This document is at http://savage.net.au/Perl/html/configure-cvsnt.html

You'll find a self-expanding version of CVS for NT at http://www.cvsnt.org/

Corresponding docs are at http://www.devguy.com/fp/cfgmgmt/cvs/cvs_admin_nt.htm

I do not use WinCVS. There are various versions of WinCVS at http://www.cvsgui.org/download.html

There are various items at http://www.cvshome.org

Good information on CVS-related mailing lists, etc is at http://www.cvshome.org/communication.html

Alternatives to VCS::CVS

Another Perl module, VCS (unrelated to VCS::CVS), which interfaces to cvs is at http://www.astray.com

Author

Ron Savage .

Home page: http://savage.net.au/index.html

Version: 1.01 01-Jun-2006

This version disguises my email address.

Version: 1.00 01-Mar-2002

Original version.

Licence

Australian Copyright © 2002 Ron Savage. All rights reserved.

        All Programs of mine are 'OSI Certified Open Source Software';
        you can redistribute them and/or modify them under the terms of
        The Artistic License, a copy of which is available at:
        http://www.opensource.org/licenses/index.html