info-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to determine the working directory?


From: Mark E. Hamilton
Subject: Re: How to determine the working directory?
Date: Wed, 30 Nov 2005 11:28:51 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913

address@hidden wrote:
Is there a CVS command that I can issue that will give me the top-level
directory from within /home/tabi/1639/source?  That is, something like:

[tabi: ~/1639/source] cvs query directory
/home/tabi/1639
[tabi: ~/1639/source]

The reason I do this is that I create a sandbox for each bug that I
work on, and I often work on several bugs at once.  In this case, I'm
working on bug 1639.  I would like to write some shell scripts that
need to know where the top level directory of my sandbox is.  I've
search the Internet and the man pages, and I see no way to do this.

Three possibilities come to mind:

1. Write your shell script to look for the top-level directory by searching up until it finds a directory that doesn't contain a 'CVS' sub-directory. The last directory with a 'CVS' sub-directory is your top-level.

2. If you have a hierarchy containing directories from different respositories, your script could diff the contents of the CVS/Root directory in the current directory with each ancestor CVS/Root file until it finds one that doesn't match. The last directory with a matching 'CVS/Root' file is your top-level.

3. You could simply look at the first path element of the line in the CVS/Repository file. That's normally the name of the top-level directory. (Note, however, that there's no guarantee that the format of this file will remain the same.)

--
----------------
Mark E. Hamilton
Orion International Technologies, Inc.
Sandia National Laboratory, NM.
505-844-7666





reply via email to

[Prev in Thread] Current Thread [Next in Thread]