[Fusionforge-commits] r8083 - trunk/gforge/plugins/scmgit/common

Roland Mas lolando at libremir.placard.fr.eu.org
Thu Sep 3 17:09:49 CEST 2009


Author: lolando
Date: 2009-09-03 17:09:49 +0200 (Thu, 03 Sep 2009)
New Revision: 8083

Modified:
   trunk/gforge/plugins/scmgit/common/GitPlugin.class.php
Log:
Display short stats, and link to Git homepage

Modified: trunk/gforge/plugins/scmgit/common/GitPlugin.class.php
===================================================================
--- trunk/gforge/plugins/scmgit/common/GitPlugin.class.php	2009-09-03 15:09:25 UTC (rev 8082)
+++ trunk/gforge/plugins/scmgit/common/GitPlugin.class.php	2009-09-03 15:09:49 UTC (rev 8083)
@@ -31,25 +31,46 @@
 		$this->hooks[] = 'scm_browser_page' ;
 		$this->hooks[] = 'scm_gather_stats' ;
 		$this->hooks[] = 'scm_generate_snapshots' ;
-		
+
 		require_once $gfconfig.'plugins/scmgit/config.php' ;
-		
+
 		$this->default_git_server = $default_git_server ;
 		if (isset ($git_root)) {
 			$this->git_root = $git_root;
 		} else {
 			$this->git_root = $GLOBALS['sys_chroot'].'/scmrepos/git' ;
 		}
-		
+
 		$this->register () ;
 	}
-	
+
 	function getDefaultServer() {
 		return $this->default_git_server ;
 	}
 
+        function printShortStats ($params) {
+                $project = $this->checkParams ($params) ;
+                if (!$project) {
+                        return false ;
+                }
+
+                if ($project->usesPlugin($this->name)) {
+                        $result = db_query_params('SELECT sum(commits) AS commits, sum(adds) AS adds FROM stats_cvs_group WHERE group_id=$1',
+                                                  array ($project->getID())) ;
+                        $commit_num = db_result($result,0,'commits');
+                        $add_num    = db_result($result,0,'adds');
+                        if (!$commit_num) {
+                                $commit_num=0;
+                        }
+                        if (!$add_num) {
+                                $add_num=0;
+                        }
+                        echo ' (Git: '.sprintf(_('<strong>%1$s</strong> commits, <strong>%2$s</strong> adds'), number_format($commit_num, 0), number_format($add_num, 0)).")";
+                }
+        }
+
 	function getBlurb () {
-		return _('<p>This GIT plugin is not completed yet.</p>') ;
+		return _('<p>Documentation for Git is available <a href="http://git-scm.com/">here</a>.</p>') ;
 	}
 
 	function getInstructionsForAnon ($project) {




More information about the Fusionforge-commits mailing list