Shlomo,
You could have your perl program check the environment for CVSROOT as shown
here:
my $CVSROOT = "$ENV{'CVSROOT'}";
if ($CVSROOT eq "") {
print "CVSROOT is not defined - aborting\n";
exit 1;
}
If you are using pserver you could remove the pserver information using:
$CVSROOT =~ s/^.*:(.*)$/$1/; # remove any pserver stuff
You could also check the CVS/Root file at the first directory in a work
area. The content of it should match CVSROOT.
Dale Miller
> -----Original Message-----
> From: Reinstein, Shlomo [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, June 23, 2002 9:11 AM
> To: '[EMAIL PROTECTED]'
> Subject: How to find out the CVSROOT and location in the
> repository of a w orking directory
>
>
> Hi,
>
> Is there a "clean" way to find out what is the CVSROOT of a working
> directory and where in the repository it is located? I need
> to find that out
> from within a Perl script, and by "clean" I mean that I
> prefer not to look
> into the CVS/Root and CVS/Repository files, because I
> consider them to be
> CVS internals that might change some day.
> I know that using "cvs status" I can find out the whole
> repository path, but
> there is no separation between the CVSROOT and the location inside the
> repository.
>
> To be more specific about what I need (maybe there's a way to
> do it without
> caring for the CVSROOT and location), I have a file in each
> module that has
> a fixed name and is used by my script to enable users to
> "lock" the module
> for a short time. Whenever a new branch is created for a
> module, this file
> should be "initialized" for that branch, to indicate that the
> branch is "not
> locked". To do this, the script should modify it and commit a
> new revision
> of it into the branch. (This is needed because the file might indicate
> "locked" state for the root of the branch.) In order to do
> this, I want to
> check-out a fresh copy of that file (okay, with its whole
> directory) to a
> temporary directory, and then do these things on the copy in
> the temporary
> directory. In order to check it out, I need the CVSROOT and
> location within
> the repository.
>
> Thanks,
> Shlomo
>
>
>
> _______________________________________________
> Info-cvs mailing list
> [EMAIL PROTECTED]
> http://mail.gnu.org/mailman/listinfo/info-cvs
>
_______________________________________________
Info-cvs mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/info-cvs