| 227 |
dpurdie |
1 |
###############################################################################
|
|
|
2 |
# CLASS Clearcase::UndoCheckoutCmd
|
|
|
3 |
# This class inherits from the CCCmpdProc and executes the cleartool command
|
|
|
4 |
# "checkin" with no default args, args can be set
|
|
|
5 |
#
|
|
|
6 |
# It Does not override CCProcess, it runs in no processing mode so output is printed
|
|
|
7 |
# directly.
|
|
|
8 |
###############################################################################
|
|
|
9 |
|
|
|
10 |
package Clearcase::UndoCheckoutCmd;
|
|
|
11 |
|
|
|
12 |
use strict;
|
|
|
13 |
use DeployUtils::Logger;
|
|
|
14 |
use Clearcase::CmdProc;
|
|
|
15 |
|
|
|
16 |
use vars qw( @ISA );
|
|
|
17 |
|
|
|
18 |
@ISA = qw( Clearcase::CmdProc );
|
|
|
19 |
|
|
|
20 |
#==============================================================================
|
|
|
21 |
# Constructor
|
|
|
22 |
#==============================================================================
|
|
|
23 |
sub new
|
|
|
24 |
{
|
|
|
25 |
my $obclass = shift;
|
|
|
26 |
my $class = ref($obclass) || $obclass;
|
|
|
27 |
my $args = "";
|
|
|
28 |
|
|
|
29 |
LogDebug("Clearcase::UndoCheckoutCmd::new Instantiating new object of class $class");
|
|
|
30 |
|
|
|
31 |
# Call base class's constructor
|
|
|
32 |
my $self = $class->SUPER::new();
|
|
|
33 |
|
|
|
34 |
# set Cmd to do no processing
|
|
|
35 |
$self->processOutput(0);
|
|
|
36 |
$self->abortOnError(0);
|
|
|
37 |
|
|
|
38 |
# Add this class's data to the class object
|
|
|
39 |
$self->{_FILELIST} = [];
|
|
|
40 |
|
|
|
41 |
bless($self, $class);
|
|
|
42 |
|
|
|
43 |
# set Clearcase command and arg
|
|
|
44 |
$self->CCcmd("uncheckout");
|
|
|
45 |
foreach my $newarg ( @_ )
|
|
|
46 |
{
|
|
|
47 |
$args .= " " . $newarg;
|
|
|
48 |
}
|
|
|
49 |
$self->CCargs($args);
|
|
|
50 |
|
|
|
51 |
return $self;
|
|
|
52 |
} # new
|
|
|
53 |
|
|
|
54 |
|
|
|
55 |
#==============================================================================
|
|
|
56 |
# addFiles
|
|
|
57 |
# Adds files to list of files to checkin
|
|
|
58 |
#==============================================================================
|
|
|
59 |
sub addFiles
|
|
|
60 |
{
|
|
|
61 |
my $self = shift;
|
|
|
62 |
|
|
|
63 |
map { $_ = "\"$_\"" } @_;
|
|
|
64 |
LogDebug("Clearcase::UndoCheckoutCmd::addFiles Added Files " . join(",", @_));
|
|
|
65 |
push( @{$self->{_FILELIST}}, @_);
|
|
|
66 |
} # addFiles
|
|
|
67 |
|
|
|
68 |
|
|
|
69 |
#==============================================================================
|
|
|
70 |
# getNumFiles
|
|
|
71 |
# Returns number of files in file list
|
|
|
72 |
#==============================================================================
|
|
|
73 |
sub getNumFiles
|
|
|
74 |
{
|
|
|
75 |
my $self = shift;
|
|
|
76 |
|
|
|
77 |
return $#{$self->{_FILELIST}};
|
|
|
78 |
} # getNumFiles
|
|
|
79 |
|
|
|
80 |
|
|
|
81 |
#==============================================================================
|
|
|
82 |
# CCexecute
|
|
|
83 |
# Overrides base class version.
|
|
|
84 |
# It simply appends files to args and calls the base class execute.
|
|
|
85 |
# If there are no files it returns without running
|
|
|
86 |
#==============================================================================
|
|
|
87 |
sub CCexecute
|
|
|
88 |
{
|
|
|
89 |
my $self = shift;
|
|
|
90 |
my $retval = 0;
|
|
|
91 |
|
|
|
92 |
if ( $#{$self->{_FILELIST}} >= 0 )
|
|
|
93 |
{
|
|
|
94 |
$self->CCaddArgs(@{$self->{_FILELIST}});
|
|
|
95 |
$retval = $self->SUPER::CCexecute();
|
|
|
96 |
}
|
|
|
97 |
else
|
|
|
98 |
{
|
|
|
99 |
LogInfo("Clearcase::UndoCheckoutCmd::CCexecute No execution as no Files supplied");
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
return $retval;
|
|
|
103 |
} # CCexecute
|