From: Rob H. <for...@us...> - 2002-06-19 08:04:39
|
Update of /cvsroot/sandweb/sandweb/lib/SandWeb/Repository In directory usw-pr-cvs1:/tmp/cvs-serv12041/lib/SandWeb/Repository Modified Files: cvs.pm Log Message: finally! added decent error checking ( it has been lacking since the post-ALPHA addition of sandweb-expect and the Shell class ). I expanded on the error reporting method I used back when cvs.pm made it's own calls to the shell ... Shell returns a hash containing "output" and "error" to cvs, cvs passes it to Repository, Repository gives it to the CGI, which assigns the VCS_OUTPUT and VCS_ERROR template variables accordingly ( VCS_ERROR uses a glaring red font in the vcs_output.html template ). This along with the better debugging should give us much more info when trying to figure out why VCS actions aren't working. Index: cvs.pm =================================================================== RCS file: /cvsroot/sandweb/sandweb/lib/SandWeb/Repository/cvs.pm,v retrieving revision 1.25 retrieving revision 1.26 diff -U2 -r1.25 -r1.26 --- cvs.pm 19 Jun 2002 07:19:04 -0000 1.25 +++ cvs.pm 19 Jun 2002 08:04:31 -0000 1.26 @@ -112,20 +112,8 @@ $log->debug("File: $file"); } - my $output = $self->shell( + my %return = $self->shell( 'param' => join('', @param), 'file' => "$file", ); - my $errorlevel = $?; - - if ( $errorlevel == 0 ) { - $errorlevel = 1; - } else { - $errorlevel = 0; - } - - my %return = ( - output => $output, - errorlevel => $errorlevel, - ); return %return; @@ -147,14 +135,8 @@ if ($type == "text") { push @param, " -kkv -MMERGE" }; - if ( $errorlevel == 0 ) { - $errorlevel = 1; - } else { - $errorlevel = 0; - } - - my %return = ( - output => $output, - errorlevel => $errorlevel, - ); + my %return = $self->shell( + 'param' => join('', @param), + 'file' => "$file", + ); return %return; @@ -181,20 +163,9 @@ $log->debug("Params: @param"); $log->debug("File: $file"); - my $output = $self->shell( + + my %return = $self->shell( 'param' => join('', @param), 'file' => "$file", ); - my $errorlevel = $?; - - if ( $errorlevel == 0 ) { - $errorlevel = 1; - } else { - $errorlevel = 0; - } - - my %return = ( - output => $output, - errorlevel => $errorlevel, - ); return %return; @@ -222,20 +193,9 @@ $log->debug("File: $file"); } - my $output = $self->shell( + + my %return = $self->shell( 'param' => join('', @param), 'file' => "$file", ); - my $errorlevel = $?; - - if ( $errorlevel == 0 ) { - $errorlevel = 1; - } else { - $errorlevel = 0; - } - - my %return = ( - output => $output, - errorlevel => $errorlevel, - ); return %return; @@ -262,4 +222,5 @@ my $output; + my %return; if (!$message) { @@ -272,5 +233,5 @@ $log->debug("File: $file"); } - $output = $self->shell( + %return = $self->shell( 'param' => join('', @param), 'file' => "$file", @@ -278,16 +239,9 @@ }; - my $errorlevel = $?; - - if ( $errorlevel == 0 ) { - $errorlevel = 1; - } else { - $errorlevel = 0; - } - - my %return = ( - output => $output, - errorlevel => $errorlevel, - ); + if ($output) { + %return = ( + output => "$output", + ); + } return %return; @@ -320,15 +274,11 @@ $log->debug("Params: @param"); $log->debug("File: $file"); - my $raw_output = $self->shell( + + my %return = $self->shell( 'param' => join('', @param), 'file' => "$file", ); - my $errorlevel = $?; - if ( $errorlevel == 0 ) { - $errorlevel = 1; - } else { - $errorlevel = 0; - } + my $raw_output = $return{'output'}; my $diff = SandWeb::Diff->new( @@ -340,5 +290,4 @@ my %return = ( output => $output, - errorlevel => $errorlevel, ); @@ -364,20 +313,9 @@ $log->debug("Params: @param"); $log->debug("File: $file"); - my $output = $self->shell( + + my %return = $self->shell( 'param' => join('', @param), 'file' => "$file", ); - my $errorlevel = $?; - - if ( $errorlevel == 0 ) { - $errorlevel = 1; - } else { - $errorlevel = 0; - } - - my %return = ( - output => $output, - errorlevel => $errorlevel, - ); return %return; @@ -400,20 +338,9 @@ $log->debug("Params: @param"); $log->debug("File: $file"); - my $output = $self->shell( + + my %return = $self->shell( 'param' => join('', @param), 'file' => "$file", ); - my $errorlevel = $?; - - if ( $errorlevel == 0 ) { - $errorlevel = 1; - } else { - $errorlevel = 0; - } - - my %return = ( - output => $output, - errorlevel => $errorlevel, - ); return %return; @@ -433,20 +360,9 @@ $log->debug("Params: @param"); $log->debug("File: $file"); - my $output = $self->shell( + + my %return = $self->shell( 'param' => join('', @param), 'file' => "$file", ); - my $errorlevel = $?; - - if ( $errorlevel == 0 ) { - $errorlevel = 1; - } else { - $errorlevel = 0; - } - - my %return = ( - output => $output, - errorlevel => $errorlevel, - ); return %return; @@ -466,20 +382,9 @@ $log->debug("Params: @param"); $log->debug("File: $file"); - my $output = $self->shell( + + my %return = $self->shell( 'param' => join('', @param), 'file' => "$file", ); - my $errorlevel = $?; - - if ( $errorlevel == 0 ) { - $errorlevel = 1; - } else { - $errorlevel = 0; - } - - my %return = ( - output => $output, - errorlevel => $errorlevel, - ); return %return; @@ -499,20 +404,9 @@ $log->debug("Params: @param"); $log->debug("File: $file"); - my $output = $self->shell( + + my %return = $self->shell( 'param' => join('', @param), 'file' => "$file", ); - my $errorlevel = $?; - - if ( $errorlevel == 0 ) { - $errorlevel = 1; - } else { - $errorlevel = 0; - } - - my %return = ( - output => $output, - errorlevel => $errorlevel, - ); return %return; @@ -539,20 +433,9 @@ $log->debug("Params: @param"); $log->debug("File: $file"); - my $output = $self->shell( + + my %return = $self->shell( 'param' => join('', @param), 'file' => "$file", ); - my $errorlevel = $?; - - if ( $errorlevel == 0 ) { - $errorlevel = 1; - } else { - $errorlevel = 0; - } - - my %return = ( - output => $output, - errorlevel => $errorlevel, - ); return %return; @@ -568,20 +451,9 @@ $log->debug("Params: @param"); $log->debug("File: $file"); - my $output = $self->shell( + + my %return = $self->shell( 'param' => join('', @param), 'file' => "$file", ); - my $errorlevel = $?; - - if ( $errorlevel == 0 ) { - $errorlevel = 1; - } else { - $errorlevel = 0; - } - - my %return = ( - output => $output, - errorlevel => $errorlevel, - ); return %return; @@ -604,20 +476,9 @@ $log->debug("Params: @param"); $log->debug("File: $file"); - my $output = $self->shell( + + my %return = $self->shell( 'param' => join('', @param), 'file' => "$file", ); - my $errorlevel = $?; - - if ( $errorlevel == 0 ) { - $errorlevel = 1; - } else { - $errorlevel = 0; - } - - my %return = ( - output => $output, - errorlevel => $errorlevel - ); return %return; @@ -645,20 +506,9 @@ $log->debug("File: $file"); } - my $output = $self->shell( + + my %return = $self->shell( 'param' => join('', @param), 'file' => "$file", ); - my $errorlevel = $?; - - if ( $errorlevel == 0 ) { - $errorlevel = 1; - } else { - $errorlevel = 0; - } - - my %return = ( - output => $output, - errorlevel => $errorlevel - ); return %return; @@ -684,20 +534,9 @@ $log->debug("Params: @param"); $log->debug("File: $file"); - my $output = $self->shell( + + my %return = $self->shell( 'param' => join('', @param), 'file' => "$file", ); - my $errorlevel = $?; - - if ( $errorlevel == 0 ) { - $errorlevel = 1; - } else { - $errorlevel = 0; - } - - my %return = ( - output => $output, - errorlevel => $errorlevel, - ); return %return; @@ -730,20 +569,9 @@ $log->debug("Params: @param"); $log->debug("File: $file"); - my $output = $self->shell( + + my %return = $self->shell( 'param' => join('', @param), 'file' => "$file", ); - my $errorlevel = $?; - - if ( $errorlevel == 0 ) { - $errorlevel = 1; - } else { - $errorlevel = 0; - } - - my %return = ( - output => $output, - errorlevel => $errorlevel - ); return %return; @@ -766,20 +594,9 @@ $log->debug("Params: @param"); $log->debug("File: $file"); - my $output = $self->shell( + + my %return = $self->shell( 'param' => join('', @param), 'file' => "$file", ); - my $errorlevel = $?; - - if ( $errorlevel == 0 ) { - $errorlevel = 1; - } else { - $errorlevel = 0; - } - - my %return = ( - output => $output, - errorlevel => $errorlevel, - ); return %return; @@ -817,17 +634,13 @@ $log->debug("Params: @param"); $log->debug("File: $file"); - my $raw_output = $self->shell( + + my %return = $self->shell( 'param' => join('', @param), 'file' => "$file", ); - my $errorlevel = $?; - my @lined_output = split(/\n/, $raw_output); + my $raw_output = $return{'output'}; - if ( $errorlevel == 0 ) { - $errorlevel = 1; - } else { - $errorlevel = 0; - } + my @lined_output = split(/\n/, $raw_output); foreach my $line (@lined_output) { @@ -857,9 +670,8 @@ } - my %return = ( - output => join('', @output_lines), - errorlevel => $errorlevel + %return = ( + output => "$output", ); - + return %return; } @@ -885,20 +697,9 @@ $log->debug("Params: @param"); $log->debug("File: $file"); - my $output = $self->shell( + + my %return = $self->shell( 'param' => join('', @param), 'file' => "$file", ); - my $errorlevel = $?; - - if ( $errorlevel == 0 ) { - $errorlevel = 1; - } else { - $errorlevel = 0; - } - - my %return = ( - output => $output, - errorlevel => $errorlevel, - ); return %return; @@ -921,20 +722,9 @@ $log->debug("Params: @param"); $log->debug("File: $file"); - my $output = $self->shell( + + my %return = $self->shell( 'param' => join('', @param), 'file' => "$file", ); - my $errorlevel = $?; - - if ( $errorlevel == 0 ) { - $errorlevel = 1; - } else { - $errorlevel = 0; - } - - my %return = ( - output => $output, - errorlevel => $errorlevel - ); return %return; @@ -987,9 +777,9 @@ ); - my $output = $shell->execute( + my %return = $shell->execute( 'command' => "cd $sandbox && CVS_RSH=$ssh_bin && export CVS_RSH && $cvs_bin -q -d $root $param \'$file\'", ); - return $output; + return %return; } |