[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Processing CVS errors
From: |
Dale Miller |
Subject: |
Re: Processing CVS errors |
Date: |
Thu, 14 Dec 2000 09:01:13 -0600 |
Donald Sharp wrote:
> Nope. You gotta look at standard error as well as the return code.
> Also cvs diff doesn't always return what you think it should either ;)
>
> donald
> On Thu, Dec 14, 2000 at 12:56:21AM -0800, Reinstein, Shlomo wrote:
> > Hi,
> > Is there some way to process CVS errors in software, other than reading the
> > text describing them from the standard error? I have Perl scripts which make
> > extensive use of CVS, and I'd like these scripts to be able to process CVS
> > errors and try to recover. I can see that CVS exits with a 0 return value
> > for success and 1 for failure, but I'd like to know (within the Perl
> > scripts) the reason for the failure and try to process them in some way.
> > Thanks in advance, Shlomo.
> >
>
Shlomo,
I have been writing Perl scripts to interact with CVS and examine the results
including output to standard error.
Some examples, completely out of context are shown below:
-----------------------------------
Testing if nothing present to commit or no CVS Entries present from
a cvs -nq update
$count = @result = `cvs -nq update 2>&1`;
if ($count == 0) {
print colored ("Nothing to commit\n", 'red on_yellow');
return 0;
}
$count = @result2 = grep /update aborted/, @result;
if ($count == 1) {
print colored ("No CVS Entries presents\n", 'red on_yellow');
return 0;
}
-----------------------------------
This is how I get the new and previous version after a commit so that
I can do a rtag on the new version:
@result2 = `cvs -q commit -m\"$scr\" $_`;
($file) = grep /Checking in/, @result2;
$file =~ s/Checking in (.*)\;$/$1/;
($new_rev) = grep /new revision:/, @result2;
chomp $new_rev;
$new_rev =~ s/.*new revision: ([\d\.]*); previous.*$/$1/;
@result2 = `cvs rtag -F -r $new_rev $scr $file`;
print colored (" @result2", 'magenta on_white');
-----------------------------------
They might give you some ideas.
Dale Miller