# sierrathedog04, jonathansamuel@yahoo.com # program to automatically checkout and checkin files for # the Clearcase version control system. # From the command line enter as the parameters specified # below. It will take the file $checkOutFile from the # directory $sourceDirand copy it in to the directory # $targetDir in the Clearcase view $viewName. # This program will generate an error message unless the # specified file already exists in both the directory # $targetDir and the directory$sourceDir. The two versions # of the file must differ. use strict; use FileHandle; my $viewName = shift; # name of Clearcase view. my $targetDir = shift; # name of directory in the Clearcase # view # which will contain the file after it is checked in my $checkOutFile = shift; # name of file to check out and # then in again. my $sourceDir = shift; #current location of file to check in my $homeDir = $ENV{HOME}; unless ( $viewName && $targetDir && $checkOutFile && $sourceDir ) { die "This subroutine takes four parameters: \n the first of wh +ich is $viewName.\n The second of which is $targetDir.\n The third of + which is $checkOutFile.\n The fourth of which is $sourceDir.\n The +first parameter is the name of the Clearcase view.\n The second param +eter is the name of the view directory \nfor which all files will be +checked in and checked out.\n The third parameter is t he name of the file to be checked out and in.\n The fourth parameter i +s the name of the directory in \nwhich the most recent copies of the +files exist. \n"; } my $fh = new FileHandle "> $homeDir/ctscript.txt"; defined $fh || die "unable to open temporary filehandle for creating e +xecutable script\n"; ctrun("setview $viewName"); ctrun("cd $targetDir"); ctrun("co -nc $checkOutFile"); ctrun("sh cp $sourceDir/$checkOutFile $targetDir/$checkOutFile"); ctrun("ci -nc $checkOutFile"); sub ctrun { my $command = shift; print $fh "$command\n"; } $fh->close; my $pid = open(PH,"cleartool < $homeDir/ctscript.txt 2>&1 |"); while (<PH>) { print "$_ \n"; die "Unable to open view $viewName. Please make certain that t +his view exists.\n" if (/View tag not found/); die "Unable to find the $targetDir directory in the VOB. Pleas +e make certain that you have specified it correctly.\n" if (/Unable t +o change directory to /); die "You have attempted to check out file $checkOutFile in the + $targetDir directory in the VOB. Please make certain that this file +exists in the VOB.\n" if (/Unable to access/ || /Not a vob object/); if (/data identical to predecessor/){ print "The version of $checkOutFile that you are attem +pting to check in from $sourceDir to $targetDir is identical to what +was there before. Cle arcase does not permit the checking in of files unless they have been +modified in some way from their previous version.\n $_ \nProcessing o +f any additional files will continue.\n" ; die; } die "There has been an error while processing file $checkOutFi +le into directory $targetDir. $_ \nProcessing of any additional files + will continue.\n" if (/Error/); } die "\n Completed checkout and checkin of files from $sourceDir\n into + the directory $targetDir\n in the view $viewName.\n";
In reply to Cleartool_Copy by sierrathedog04
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |