############################################################################### # CLASS Clearcase::UndoCheckoutCmd # This class inherits from the CCCmpdProc and executes the cleartool command # "checkin" with no default args, args can be set # # It Does not override CCProcess, it runs in no processing mode so output is printed # directly. ############################################################################### package Clearcase::UndoCheckoutCmd; use strict; use DeployUtils::Logger; use Clearcase::CmdProc; use vars qw( @ISA ); @ISA = qw( Clearcase::CmdProc ); #============================================================================== # Constructor #============================================================================== sub new { my $obclass = shift; my $class = ref($obclass) || $obclass; my $args = ""; LogDebug("Clearcase::UndoCheckoutCmd::new Instantiating new object of class $class"); # Call base class's constructor my $self = $class->SUPER::new(); # set Cmd to do no processing $self->processOutput(0); $self->abortOnError(0); # Add this class's data to the class object $self->{_FILELIST} = []; bless($self, $class); # set Clearcase command and arg $self->CCcmd("uncheckout"); foreach my $newarg ( @_ ) { $args .= " " . $newarg; } $self->CCargs($args); return $self; } # new #============================================================================== # addFiles # Adds files to list of files to checkin #============================================================================== sub addFiles { my $self = shift; map { $_ = "\"$_\"" } @_; LogDebug("Clearcase::UndoCheckoutCmd::addFiles Added Files " . join(",", @_)); push( @{$self->{_FILELIST}}, @_); } # addFiles #============================================================================== # getNumFiles # Returns number of files in file list #============================================================================== sub getNumFiles { my $self = shift; return $#{$self->{_FILELIST}}; } # getNumFiles #============================================================================== # CCexecute # Overrides base class version. # It simply appends files to args and calls the base class execute. # If there are no files it returns without running #============================================================================== sub CCexecute { my $self = shift; my $retval = 0; if ( $#{$self->{_FILELIST}} >= 0 ) { $self->CCaddArgs(@{$self->{_FILELIST}}); $retval = $self->SUPER::CCexecute(); } else { LogInfo("Clearcase::UndoCheckoutCmd::CCexecute No execution as no Files supplied"); } return $retval; } # CCexecute