Hi, In my question, I was referring ONLY to the CVSROOT (and repository location) of a working directory. Inside a working directory, the information is stored in the CVS/Root and CVS/Repository files, and the CVSROOT environment variable is not at all interesting (because it is overriden by the CVS/Root file). Like I said, I could read the CVS/Root file, but I consider this file to be "CVS internals", and thus reading it is not a clean solution (that is, I would have to change my script if the implementation of CVS changed and this file was renamed, for example). I got another answer that said to run "cvs -t status" (use the global "-t" option). The problem with this, as far as I'm concerned, is that the CVSROOT information from the "-t" option goes to the standard error, rather than the standard output. Thanks, Shlomo
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, June 24, 2002 3:27 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: How to find out the CVSROOT and location in the repository of a w orking directory 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
