Subversion Repositories DevTools

Rev

Rev 5282 | Rev 5710 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5282 Rev 5284
Line 247... Line 247...
247
    $data->setProperty('count.file', $find_files);
247
    $data->setProperty('count.file', $find_files);
248
    $data->setProperty('count.dir',  $find_dirs);
248
    $data->setProperty('count.dir',  $find_dirs);
249
    $data->setProperty('count.dirdepth',  $find_depth);
249
    $data->setProperty('count.dirdepth',  $find_depth);
250
    $data->setProperty('count.makefile',  $find_makefiles);
250
    $data->setProperty('count.makefile',  $find_makefiles);
251
 
251
 
252
	#
252
    #
253
	#	Dirty test for subversion usage
253
    #   Dirty test for subversion usage
254
	#
254
    #
255
	if ( -d '.svn' )
255
    if ( -d '.svn' )
256
	{
256
    {
257
		Message('Subversion workspace');
257
        Message('Subversion workspace');
258
	}
258
    }
259
	else
259
    else
260
	{
260
    {
261
        #
261
        #
262
        #   Determine the number of clearcase branches used by files
262
        #   Determine the number of clearcase branches used by files
263
        #   and folders in this view
263
        #   and folders in this view
264
        #
264
        #
265
        Verbose ("Determine ClearCase branches");
265
        Verbose ("Determine ClearCase branches");
266
 
266
 
267
        #
267
        #
268
		#   Ensure that the 'cleartool' program can be located
268
        #   Ensure that the 'cleartool' program can be located
269
		#
269
        #
270
		Verbose2 ("Locate clearcase utility in users path");
270
        Verbose2 ("Locate clearcase utility in users path");
271
		Error ("Cannot locate the 'cleartool' utility in the users PATH")
271
        Error ("Cannot locate the 'cleartool' utility in the users PATH")
272
			unless ( LocateProgInPath('cleartool', '--All') );
272
            unless ( LocateProgInPath('cleartool', '--All') );
273
 
273
 
274
		my %branches;
274
        my %branches;
275
		my $cmd = QuoteCommand (qw (cleartool ls -vob_only -visible -rec -short), $opt_root );
275
        my $cmd = QuoteCommand (qw (cleartool ls -vob_only -visible -rec -short), $opt_root );
276
		Verbose2($cmd);
276
        Verbose2($cmd);
277
 
277
 
278
		open(CMD, "$cmd 2>&1 |") || Error( "can't run command: $!");
278
        open(CMD, "$cmd 2>&1 |") || Error( "can't run command: $!");
279
		while (<CMD>)
279
        while (<CMD>)
280
		{
280
        {
281
			chomp;
281
            chomp;
282
			tr~\\/~/~s;                 # Clean up and convert multiple / and \ -> /
282
            tr~\\/~/~s;                 # Clean up and convert multiple / and \ -> /
283
 
283
 
284
			#
284
            #
285
			#   If we are not within a VOB, then we will get errors
285
            #   If we are not within a VOB, then we will get errors
286
			#
286
            #
287
			if ( m~cleartool: Error:~i )
287
            if ( m~cleartool: Error:~i )
288
			{
288
            {
289
				Verbose ( $_ );
289
                Verbose ( $_ );
290
				next;
290
                next;
291
			}
291
            }
292
 
292
 
293
			#
293
            #
294
			#   Split the line into filename and branch
294
            #   Split the line into filename and branch
295
			#   Only want the last branch. DOn't need the version on the branch
295
            #   Only want the last branch. DOn't need the version on the branch
296
			#
296
            #
297
			m~([^/]+)\@\@.*/(.+)/\d+~;
297
            m~([^/]+)\@\@.*/(.+)/\d+~;
298
			my $file = $1;
298
            my $file = $1;
299
			my $branch = $2;
299
            my $branch = $2;
300
			Verbose2( "ct ls: " . $_ . ": $file,[$branch]");
300
            Verbose2( "ct ls: " . $_ . ": $file,[$branch]");
301
 
301
 
302
			#
302
            #
303
			#   Ignore build files
303
            #   Ignore build files
304
			#   Try to catch naughty users that put non-buildfiles onthe auto builder branch
304
            #   Try to catch naughty users that put non-buildfiles onthe auto builder branch
305
			#
305
            #
306
			next if ( $file eq 'build.pl' );
306
            next if ( $file eq 'build.pl' );
307
			next if ( $file =~ m~depends\.xml$~ );
307
            next if ( $file =~ m~depends\.xml$~ );
308
 
308
 
309
			$branches{$branch} = 0
309
            $branches{$branch} = 0
310
				unless ( exists $branches{$branch} );
310
                unless ( exists $branches{$branch} );
311
			$branches{$branch}++;
311
            $branches{$branch}++;
312
		}
312
        }
313
		close(CMD);
313
        close(CMD);
314
		
314
        
315
		my @blist = sort keys %branches;
315
        my @blist = sort keys %branches;
316
		$data->setProperty('ccbranch.count',  1 + $#blist );
316
        $data->setProperty('ccbranch.count',  1 + $#blist );
317
		$data->setProperty('ccbranch.list',  join (',', @blist) );
317
        $data->setProperty('ccbranch.list',  join (',', @blist) );
318
    }
318
    }
319
 
319
 
320
    #
320
    #
321
    #   All done
321
    #   All done
322
    #   Save the current set of metrics
322
    #   Save the current set of metrics