a little scripting challenge

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
Ok, here's the scenario:

<preamble>
I have a cvs checkout that I want multiple people to use (same checkout, not just the same repository). I want them each to be able to commit using their own cvs account. I know this is not ideal, but these are non-technical people and I the idea was to have them all work on the same set of files without worrying about deploying them (it's a website).

The problem is that cvs keeps a cvsroot for the entire checkout, stored in each CVS\Root file. This cvsroot includes my user name and now cvs won't let anyone commit without logging in as me. If you know of an easy way to switch cvsroots I'll take that but otherwise I have to do in a little more manually.
</preamble>

<challenge>
I need a script that will traverse a folder structure, find all the CVS\Root files (which consist of a single line like so : pserver:user.name@servername:/usr/local/cvsroot) and change the user.name to a different user.name. You can use anything that comes with an xp pro install or basic unix utilities (unxutils.sourceforge.net) or something else that is easy to install.
I will personally be writing an ant/java solution but I'd like to see if anyone comes up with something smoother (and I'm sure you can :)).
</challenge>

Edit: damn, I should remember that you can't post :pserver: on any sort of chat program...
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
They cannot use their own accounts to commit stuff because of this file? I'm guessing something is setup wrong, since plenty of LARGE development groups use CVS without issues...
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
CVS/Root
Pathname to the repository ( CVSROOT ) location at
the time of checkout. This file is used instead of
the CVSROOT environment variable if the environment
variable is not set. A warning message will be
issued when the contents of this file and the CVS-
ROOT environment variable differ. The file may be
over-ridden by the presence of the
CVS_IGNORE_REMOTE_ROOT environment variable.
 

notfred

Lifer
Feb 12, 2001
38,241
4
0
I haven't actually tested this (don't have your directory structure to try it with), but it should work.
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
Originally posted by: n0cmonkey
They cannot use their own accounts to commit stuff because of this file? I'm guessing something is setup wrong, since plenty of LARGE development groups use CVS without issues...
The setup is definitely not the recommended usage of cvs. Ordinarily each developer will work with their own checked out version of the code. The reason this is different is because it's a test website (a mirror of the corporate one) and the files under cvs control are also the same ones deployed under jboss. Normally, each user would have their own copy of the code and when they finish making changes they would deploy the files to jboss using a build script. Because the users are non-technical types and because the build step is really unnecessary I want to only have one checked out version.
Originally posted by: n0cmonkey
CVS/Root
Pathname to the repository ( CVSROOT ) location at
the time of checkout. This file is used instead of
the CVSROOT environment variable if the environment
variable is not set. A warning message will be
issued when the contents of this file and the CVS-
ROOT environment variable differ. The file may be
over-ridden by the presence of the
CVS_IGNORE_REMOTE_ROOT environment variable.
:eek: I have to admit, trying to override it with environment variables had not occured to me. That sounds like a perfect solution, as each user will be logged in under a different account. This isn't the commandline client (it's WinCvs) but it does use a version of it so hopefully it will still work as documented. This should be as easy as setting CVSROOT in combination with %USERNAME% :).

notfred, thanks for your contribution. If I had perl installed on any of the machines I have available I would certainly give that a try :p
 

notfred

Lifer
Feb 12, 2001
38,241
4
0
Originally posted by: kamper
notfred, thanks for your contribution. If I had perl installed on any of the machines I have available I would certainly give that a try :p

You said, "or anything else that's easy to install". ActivePerl.
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
It's a no go on the CVS_IGNORE_REMOTE_ROOT. That was only applicable to older versions of the client. I don't understand why they had to remove it :(

Anyways, next up is java and/or perl...