[evolvis-commits] r9259: Patch [ #615 ] CVS Stats User Script Generator + CVS project history↵

mirabilos at evolvis.org mirabilos at evolvis.org
Thu Feb 24 17:22:05 CET 2011


Author: mirabilos
Date: 2011-02-24 17:22:05 +0100 (Thu, 24 Feb 2011)
New Revision: 9259

Modified:
   trunk/gforge_base/evolvisforge-5.1/gforge/deb-specific/stats_cvs.pl
   trunk/gforge_base/evolvisforge-5.1/gforge/www/scm/index.php
Log:
Patch [ #615 ] CVS Stats User Script Generator + CVS project history


Modified: trunk/gforge_base/evolvisforge-5.1/gforge/deb-specific/stats_cvs.pl
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/deb-specific/stats_cvs.pl	2011-02-24 16:22:04 UTC (rev 9258)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/deb-specific/stats_cvs.pl	2011-02-24 16:22:05 UTC (rev 9259)
@@ -149,6 +149,69 @@
 	print "-----------------------------------------------------\n";
 }
 
+sub cvs_stats_merge {
+        print "-----------------------------------------------------\n";
+        print "Inserting cvs data into\n";
+        print "-----------------------------------------------------\n";
+	my ($sql,$res,$temp);
+	$sql = "DELETE FROM stats_cvs_group 
+		WHERE (month,day,group_id) IN (
+			SELECT d.month+ d.year*100,
+	 			d.day,g.group_id 
+			FROM deb_cvs_group_user AS d,	groups AS g
+			WHERE d.cvsgroup=g.unix_group_name 
+			GROUP BY d.month,d.year,d.day,g.group_id 
+		)";
+	$dbh->do ( $sql );
+	$sql = "INSERT INTO stats_cvs_group 
+		SELECT d.month + d.year * 100,
+			d.day,g.group_id, 
+			sum(coalesce(d.others,0)),
+			sum(coalesce(d.modified,0)),
+			sum(COALESCE(d.added,0)) 
+		FROM deb_cvs_group_user AS d,groups AS g
+		WHERE d.cvsgroup=g.unix_group_name 
+			and (d.month + d.year * 100,
+			d.day,
+			g.group_id) NOT IN (
+				SELECT month,day,group_id FROM stats_cvs_group 
+				)
+		GROUP BY year,month,day,group_id
+		";
+	$dbh->do ( $sql );
+	
+	$sql = "DELETE FROM stats_cvs_user 
+		WHERE (month,day,group_id,user_id) IN (
+			SELECT d.month+ d.year*100,
+	 			d.day,g.group_id,u.user_id
+			FROM deb_cvs_group_user AS d, groups AS g, users as u
+			WHERE d.cvsgroup=g.unix_group_name AND d.cvsuser=u.user_name 
+			GROUP BY d.month,d.year,d.day,g.group_id,u.user_id 
+		)";
+	$dbh->do ( $sql );
+	$sql = "INSERT INTO stats_cvs_user
+		SELECT d.month + d.year * 100,
+			d.day,
+			g.group_id, 
+			u.user_id,
+			sum(coalesce(d.others,0)),
+			sum(coalesce(d.modified,0)),
+			sum(COALESCE(d.added,0)) 
+		FROM deb_cvs_group_user AS d,groups AS g, users AS u
+		WHERE d.cvsgroup=g.unix_group_name and
+			d.cvsuser=u.user_name
+			and (d.month + d.year * 100,
+			d.day,
+			g.group_id,
+			u.user_id) NOT IN (
+				SELECT month,day,group_id,user_id FROM stats_cvs_user
+				)
+		GROUP BY year,month,day,group_id,user_id
+		";
+	$dbh->do ( $sql );
+	
+	print "  [ x ] Done\n";
+}
 #############
 # main      #
 #############
@@ -158,5 +221,6 @@
 &dump_history;
 &parse_history;
 &print_stats;
+&cvs_stats_merge;
 &drop_tables;
 

Modified: trunk/gforge_base/evolvisforge-5.1/gforge/www/scm/index.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/scm/index.php	2011-02-24 16:22:04 UTC (rev 9258)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/scm/index.php	2011-02-24 16:22:05 UTC (rev 9259)
@@ -82,30 +82,30 @@
 		<?php echo $HTML->boxTop($Language->getText('scm_index', 'history')); ?>
 
 <?php
-// ################ is there commit info?
-$res_cvshist = db_query("SELECT * FROM group_cvs_history WHERE group_id='$group_id'");
-if (db_numrows($res_cvshist) < 1) {
-?>
-		<p>
-		<?php echo $Language->getText('scm_index', 'nohistory'); ?>
-<?php
-} else {
-?>
-		<p>
-		<b><?php echo $Language->getText('scm_index','developer_commits_adds'); ?></b>
-		<br> 
+// ######################### CVS
 
-<?php
-	while ($row_cvshist = db_fetch_array($res_cvshist)) {
-?>
-		<br><? print $row_cvshist['user_name'].' ('.$row_cvshist['cvs_commits_wk'].'/'
-		.$row_cvshist['cvs_commits'].') ('.$row_cvshist['cvs_adds_wk'].'/'
-		.$row_cvshist['cvs_adds'].')'; ?>
-<?php
-	}
+$result = db_query("
+	SELECT u.realname, sum(commits) as commits, sum(adds) as adds, sum(adds+commits) as combined
+	FROM stats_cvs_user s, users u
+	WHERE group_id='$group_id' AND s.user_id=u.user_id AND (commits>0 OR adds >0)
+	GROUP BY group_id, realname
+	ORDER BY combined DESC, realname;
+");
 
-} // ### else no cvs history
+if (db_numrows($result) > 0) {
+	print '<hr size="1" noshade="noshade" />';
 
+	$headerMapping = array(
+	'realname' => array("Name", 'width="60%"'),
+	'adds' 	=> array("Adds", 'width="13%"'),
+	'commits' => array("Commits", 'width="13%"')
+	);
+	ShowResultSet($result,'', false, true, $headerMapping, array('combined'));
+}
+else {
+	echo $Language->getText('scm_index', 'nohistory');
+}
+
 // ############################## CVS Browsing
 
 $anonymous = 1;



More information about the evolvis-commits mailing list