[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to find out the CVSROOT and location in the repository of a w or
From: |
Eric Siegerman |
Subject: |
Re: How to find out the CVSROOT and location in the repository of a w orking directory |
Date: |
Mon, 24 Jun 2002 18:31:08 -0400 |
User-agent: |
Mutt/1.2.5i |
On Sun, Jun 23, 2002 at 05:11:08PM +0300, Reinstein, Shlomo wrote:
> 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?
On Mon, Jun 24, 2002 at 07:27:20AM -0500, address@hidden wrote:
>
> You could have your perl program check the environment for CVSROOT [...]
No! You *cannot* depend on the CVSROOT environment variable to
tell you the root of a given working directory. It's only used
when there is no working directory available from which to read a
CVS/Root file.
Shlomo Reinstein again:
> [...] 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 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
It strikes me as *far* more dangerous to depend on "-t" output than on
CVS/Root!
> 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.
Three possibilities:
1. Do this in place, without using a temporary directory:
- use "cvs status lock-file" (no -t needed) to learn which
is the sticky branch or date for the file, if any
- use "cvs update -r <new-branch> lock-file" to put the
lock file onto the correct branch
- make your changes, and commit
- use "cvs update -C" (and either -D/-r or -A) to restore
the lock file to its previous state
2. Use the temporary directory, but copy it from the working
directory rather than checking it out fresh.
- Use something like this shell pseudocode to set up the
temporary directory:
cd working-dir
mkdir /tmp/foo$$
cp -pR lock-file CVS /tmp/foo$$
(Note that we only copy the lock file itself, not the
rest of the directory's contents.)
- Make your changes to the temporary copy
- Commit. You'll have to name the file explicitly:
cvs commit lock-file
Otherwise the up-to-date check will fail, because all
the other files in the (temporary) working directory
will be missing.
3. As Larry Jones says, give in and use CVS/Root and
CVS/Repository.
--
| | /\
|-_|/ > Eric Siegerman, Toronto, Ont. address@hidden
| | /
Anyone who swims with the current will reach the big music steamship;
whoever swims against the current will perhaps reach the source.
- Paul Schneider-Esleben