Subversion Repositories DevTools

Rev

Rev 227 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 227 Rev 241
Line 41... Line 41...
41
#
41
#
42
#   Globals
42
#   Globals
43
#
43
#
44
my @error_list;
44
my @error_list;
45
my $last_result;
45
my $last_result;
46
my $last_result_1;
46
my @last_results;
47
 
47
 
48
my $result = GetOptions (
48
my $result = GetOptions (
49
                "help+"         => \$opt_help,          # flag, multiple use allowed
49
                "help+"         => \$opt_help,          # flag, multiple use allowed
50
                "manual"        => \$opt_manual,        # flag
50
                "manual"        => \$opt_manual,        # flag
51
                "verbose+"      => \$opt_verbose,       # flag
51
                "verbose+"      => \$opt_verbose,       # flag
Line 236... Line 236...
236
if ( ClearCmd( "lsco -long -brtype $opt_branch $opt_ofile" ) )
236
if ( ClearCmd( "lsco -long -brtype $opt_branch $opt_ofile" ) )
237
{
237
{
238
    Error ("Internal error. Cleartool lsco should not fail");
238
    Error ("Internal error. Cleartool lsco should not fail");
239
}
239
}
240
 
240
 
-
 
241
#
-
 
242
#   Can only have one 'reserved' checkout on the branch, but it may not
-
 
243
#   be the first one listed.
-
 
244
#       Lines are in sets of 3
-
 
245
#           1) Not used
-
 
246
#           2) Has keyword reserved
-
 
247
#           3) Has full path to view server
241
if ( $last_result && $last_result_1 =~ m/\(reserved\)/ )
248
#   Need veiew server path, iff its a reserved checkout
-
 
249
#
-
 
250
my $reserved = undef;
-
 
251
foreach ( @last_results )
242
{
252
{
243
    #
253
    #
244
    #   Determine the target view an unreserve the checkout
-
 
245
    #   There will only be one as one one version can be reserved on a branch
254
    #   Once reserved has been seen, the next line will contain the view path
246
    #
255
    #
-
 
256
    if ( $reserved )
-
 
257
    {
247
    $last_result =~ m~\(\"(.+)\"\)~;
258
        m~\(\"(.+)\"\)~;
248
    my $view = $1;
259
        my $view = $1;
249
    $view =~ s~/~\\~g unless ( $ENV{GBE_UNIX} );
260
        $view =~ s~/~\\~g unless ( $ENV{GBE_UNIX} );
250
    Verbose2 ("Reserved checkout: Target View: $view" );
261
        Verbose2 ("Reserved checkout: Target View: $view" );
251
    ClearCmd( "unreserve -comment \"Unreserved by JATS ASAVE\" -view \"$view\" $opt_ofile" );
262
        ClearCmd( "unreserve -comment \"Unreserved by JATS ASAVE\" -view \"$view\" $opt_ofile" );
252
}
263
 
-
 
264
        #
-
 
265
        #   Only one reserved file can exist, so there is no more to do
-
 
266
        #
-
 
267
        last;
-
 
268
    }
253
 
269
 
-
 
270
    #
-
 
271
    #   Check to see if this line flags a reserved version
-
 
272
    #
-
 
273
    $reserved = m~\(reserved\)~;
-
 
274
}
254
 
275
 
255
#
276
#
256
#   Use clearcase to checkout the output file
277
#   Use clearcase to checkout the output file
257
#
278
#
258
ClearCmd ("co -nc -nq -ndata -nwarn -branch \"$target_branch\" $opt_ofile");
279
ClearCmd ("co -nc -nq -ndata -nwarn -branch \"$target_branch\" $opt_ofile");
Line 302... Line 323...
302
exit 0;
323
exit 0;
303
 
324
 
304
#-------------------------------------------------------------------------------
325
#-------------------------------------------------------------------------------
305
# Function        : ClearCmd
326
# Function        : ClearCmd
306
#
327
#
307
# Description     : Similar to the system command
328
# Description     : Execute a ClearCase command and capture the reults
308
#                   Does allow standard output and standard error to be captured
-
 
309
#                   to a log file
329
#                   Errors are held in one array
310
#
-
 
311
#                   Used since I was having problems with calling other programs
-
 
312
#                   and control-C. It could hang the terminal session.
330
#                   Result are held in another
313
#
331
#
314
# Inputs          :
332
# Inputs          :
315
#
333
#
316
# Returns         :
334
# Returns         :
317
#
335
#
Line 319... Line 337...
319
{
337
{
320
    my( $cmd ) = @_;
338
    my( $cmd ) = @_;
321
    Verbose2( "cleartool $cmd" );
339
    Verbose2( "cleartool $cmd" );
322
 
340
 
323
        @error_list = ();
341
        @error_list = ();
-
 
342
        @last_results = ();
324
        $last_result = undef;
343
        $last_result = undef;
325
        $last_result_1 = undef;
-
 
326
 
344
 
327
        open(CMD, "cleartool $cmd  2>&1 |")    || Error( "can't run command: $!" );
345
        open(CMD, "cleartool $cmd  2>&1 |")    || Error( "can't run command: $!" );
328
        while (<CMD>)
346
        while (<CMD>)
329
        {
347
        {
330
            chomp;
348
            chomp;
331
            $last_result_1 = $last_result;
-
 
332
            $last_result = $_;
349
            $last_result = $_;
333
            $last_result =~ tr~\\/~/~s;
350
            $last_result =~ tr~\\/~/~s;
-
 
351
            push @last_results, $last_result;
334
 
352
 
335
            Verbose ( "cleartool resp:" . $_);
353
            Verbose ( "cleartool resp:" . $_);
336
            push @error_list, $_ if ( m~Error:~ );
354
            push @error_list, $_ if ( m~Error:~ );
337
        }
355
        }
338
        close(CMD);
356
        close(CMD);