[Top][All Lists]

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

Re: Asking CVS if a repository/module/tag exists.

From: R Bresner
Subject: Re: Asking CVS if a repository/module/tag exists.
Date: Tue, 28 Aug 2001 17:25:15 +0100

One way is to check the output of "cvs log", which lists
all tags on a given file. The only thing there is that you
will still get a lot of output spewed to the screen.
And, you'll have to pick a file which you know should have
all relevent tags (A file that will be part of every tag).

        cvs log -h <file>

will report all tags, under the "symbolic names" section,
and nothing else. 

Now, also consider that "grep" exits non-zero if it doesn't
find a match (on NT anyway... you can test your platform):

        > cvs log -h buildsql | grep MY_INVALID_TAG
        > echo %ERRORLEVEL%

See that? If memory serves (it's been a nasty while) make
gets pissy on commands that exit non-zero. So, that command
could be better in the makefile, and it hides all output.

If grep doesn't do what you want, you could wrap a similar
command in a script or something, called from the makefile like,
        perl -wS is_valid_tag $(USER_SUPPLIED_TAG)
and the script could be as stupid as:

        $exit_value = 1;
        open BLUH, 'cvs log -h some_file_with_all_tags|';
        while( <BLUH> )  {
           $exit_value = 0 if /$ARGV[0]/;
        exit $exit_value;

...with much better error checks and whatnot, of course.

Of course, now someone will come back and tell us all that
there is some new feature of .. cvs delete or something that finds
tag names for us.

John Daniel Doucette wrote:
> Hi,
> Given a <repository>, <module>, and <tag> is there a polite way to ask
> if the combination exists, without actually checking it out, that
> would
> work in a make file.  I.e. the command should fail if one of the three
> supplied parameters are incorrect, but succeed otherwise.  Currently I
> am
> using this construct in a make file, which works, but seems rather
> brutish.
> cvs -d <repository> -r checkout -p -r <tag>  <module>
> If the repository/tag/module is wrong it does fail, but if it is ok
> you get
> a large amount of stuff spewed to the screen.   Redirecting outout to
> a
> file helps a bit. I couldn't find anything appropriate in cvs status
> or cvs
> log.
> ===================================
> John Daniel Doucette, Sr. Software Designer

reply via email to

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