Skip navigation.

JOracle

Oracle's Java technologies: JDeveloper, OC4J, ADF

Posts tagged with "repository"

Batch Script to Alter CVS Location [PC Only]

, , ,

It's been a while since I made a post on here. This is not because I haven't wanted to, but because the company I work for has been blocking every blog site. Thankfully, they seem to have relaxed a bit and I can post some of the things I've been waiting to.

Firstly, before I go into this, I want to apologise to any non-PC users. This blog is specifically for the PC. I only use a PC at work and home and don't have an amazing knowledge of Linux or Mac OS.

So, what's this post about?
Basically, at work we have very few resources (servers) and it takes a long time to get new machines. So when we first set up a CVS repository for our code (using CVSNT), we didn't have a dedicated development box. So we set it up on one of our developer workstations.

This was fine for a while, but then we got a server for deploying and testing our development work. Even though this was not perfect for the CVS repository, it was better than a workstation. So we moved the repository.

Then we came across a problem. There were a number of developers working on code in this repository, who had local copies (with changes). In this project there are hundreds of folders, each with a CVS subfolder and a Root file inside detailing the location of the repository. It would take far too much time for everyone to manually edit all these files, so wrote a batch script to do the job for us. I then improved it in case we needed to change other aspects of the root string at a later date.

The script works in one of two ways:
1. User specifies one or more "sections" of the root string to replace.
2. User specifies the entire root string.

The root string is made up of a number of sections:
:protocol:user.name@host:/folder

protocol - pserver, ext, ssh,...
user.name - The CVS username
host - The host machine (server)
folder - The CVS module

In the first way of using the script, the user can replace one or more of these sections:
CVSUTIL /P protocol /U user.name /H host /F folder


In the second way, the user can replace the entire root string:
CVSUTIL /S :protocol:user.name@host:/folder


In both these methods, the current path with be treated as the top folder in a local copy, or the user can specify a path:
CVSUTIL C:\LocalCopy /S :protocol:user.name@host:/folder


The script will use the user-supplied values and iterate through all the Root files in all the CVS subfolders and change the contents. Once it has finished, the local copy should be pointing to the new location of the CVS repository and life can go on as normal!

I've attached the script to this post and it is freely available for anyone to look at the guts and modify or improve it. I would appreciate it if you help me and others and post your improvements to this blog :smile: Also some of the stuff in there is quite complex and hard to follow, so if there is demand, I may write a blog explaining some of the techniques I have used.

So here it is...
cvsutil.bat
December 2009
S M T W T F S
November 2009January 2010
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31