Useful Script to run stats against a large set of repo's

1 message Options
Embed this post
Permalink
jdunmroe

Useful Script to run stats against a large set of repo's

Reply Threaded More More options
Print post
Permalink
Hi,

Wrote this (php-cli) script for running this against a large set of repo's, found it quite handy.

Feel free to use (I'm sure this could be developed to have each repo as an XML/INI file, than develope statSVN further to read these in and generate output... ;) )


Thanks.

<?php

	$rootDir = "/dir/where/you/have/repos/checked/out/";
	
	$outDir  = " /home/svnout/ "; //SOMEHERE LOCAL, THAT HAS RW PERMISSIONS (777)

	$dirs = array(
		'repo1',
                'repo2',
                'repo3'			
	);

	$exludes = array(	
		'repo2' 	=> '-exclude js/**'		,	
	);

	foreach($dirs as $dir)
	{
		print "$dir: ".exec('svn up '.$rootDir.$dir)."\n";
		print exec('svn log '. $rootDir.$dir. ' --xml -v > '.$rootDir.$dir.'/svn.log')."\n";
		print exec('rm -rf '.$outDir.$dir)."\n";
		print exec('mkdir '.$outDir.$dir)."\n";
		
		if($exludes[$dir] <> "")
			$excl = $exludes[$dir];
		else
			$excl = "";

		print exec('java -jar statsvn.jar -output-dir '.$outDir.$dir. '/ '.$excl.' ' .$rootDir.$dir.'/svn.log '.$rootDir.$dir.'/')."\n";
	
	}

?>