[Fusionforge-commits] r8020 - in trunk/gforge: debian etc/httpd.d packaging/dirs plugins/scmdarcs/common

Roland Mas lolando at libremir.placard.fr.eu.org
Thu Aug 27 15:46:07 CEST 2009


Author: lolando
Date: 2009-08-27 15:46:07 +0200 (Thu, 27 Aug 2009)
New Revision: 8020

Added:
   trunk/gforge/etc/httpd.d/61plugin-scmdarcs
Modified:
   trunk/gforge/debian/rules
   trunk/gforge/etc/httpd.d/06maindirhttp
   trunk/gforge/packaging/dirs/plugin-scmdarcs
   trunk/gforge/plugins/scmdarcs/common/DarcsPlugin.class.php
Log:
Fixes to Darcs browser

Modified: trunk/gforge/debian/rules
===================================================================
--- trunk/gforge/debian/rules	2009-08-27 13:45:57 UTC (rev 8019)
+++ trunk/gforge/debian/rules	2009-08-27 13:46:07 UTC (rev 8020)
@@ -166,7 +166,8 @@
 	rm -f $(CURDIR)/debian/$(PACKAGE)-web-apache2/usr/share/*/www/themes/$(PACKAGE)/COPYING
 
 	ln -s /usr/lib/cgi-bin/darcsweb.cgi $(CURDIR)/debian/$(PACKAGE)-plugin-scmdarcs/usr/share/gforge/plugins/scmdarcs/cgi-bin/
-	ln -s /etc/gforge/plugins/scmdarcs/config.py $(CURDIR)/debian/$(PACKAGE)-plugin-scmdarcs/usr/share/gforge/plugins/scmdarcs/cgi-bin/
+	ln -s /usr/share/darcsweb $(CURDIR)/debian/$(PACKAGE)-plugin-scmdarcs/usr/share/gforge/plugins/scmdarcs/www/darcsweb
+	ln -s ../../plugins/scmdarcs/www $(CURDIR)/debian/$(PACKAGE)-plugin-scmdarcs/usr/share/gforge/www/plugins/
 
 	# Remove Snoopy class from binary packages (provided by libphp-snoopy)
 	for i in $(addprefix $(CURDIR)/debian/,$(shell dh_listpackages)) ; do find $$i -name Snoopy.class.php | xargs rm -rf ; done

Modified: trunk/gforge/etc/httpd.d/06maindirhttp
===================================================================
--- trunk/gforge/etc/httpd.d/06maindirhttp	2009-08-27 13:45:57 UTC (rev 8019)
+++ trunk/gforge/etc/httpd.d/06maindirhttp	2009-08-27 13:46:07 UTC (rev 8020)
@@ -24,7 +24,7 @@
 		Include   {gforge_etc}/httpd.secrets
 	</Directory>
 
-	ScriptAliasMatch ^{sys_urlprefix}plugins/([^/]*)/cgi-bin/(.*) /usr/share/gforge/plugins/$1/cgi-bin/$2
+	ScriptAliasMatch ^{sys_urlprefix}plugins/([^/]*)/cgi-bin/(.*) {usr_share_gforge}/plugins/$1/cgi-bin/$2
 
 	# Projects and Users script
 	<Location {sys_urlprefix}projects>
@@ -63,7 +63,7 @@
 	    allow from all
         </Directory>
 
-	Alias {sys_urlprefix} /usr/share/gforge/www/
+	Alias {sys_urlprefix} {usr_share_gforge}/www/
 
         Alias /anonscm/ {var_lib_gforge}/chroot/scmrepos/
         <DirectoryMatch {var_lib_gforge}/chroot/scmrepos/[^/]*>

Added: trunk/gforge/etc/httpd.d/61plugin-scmdarcs
===================================================================
--- trunk/gforge/etc/httpd.d/61plugin-scmdarcs	                        (rev 0)
+++ trunk/gforge/etc/httpd.d/61plugin-scmdarcs	2009-08-27 13:46:07 UTC (rev 8020)
@@ -0,0 +1,3 @@
+<Directory {usr_share_gforge}/plugins/scmdarcs/cgi-bin>
+  SetEnv DARCSWEB_CONFPATH /etc/gforge/plugins/scmdarcs/
+</Directory>

Modified: trunk/gforge/packaging/dirs/plugin-scmdarcs
===================================================================
--- trunk/gforge/packaging/dirs/plugin-scmdarcs	2009-08-27 13:45:57 UTC (rev 8019)
+++ trunk/gforge/packaging/dirs/plugin-scmdarcs	2009-08-27 13:46:07 UTC (rev 8020)
@@ -2,4 +2,6 @@
 etc/gforge/plugins/scmdarcs
 usr/share/gforge/plugins/scmdarcs/cgi-bin
 usr/share/gforge/plugins/scmdarcs/common
+usr/share/gforge/plugins/scmdarcs/www
+usr/share/gforge/www/plugins
 var/lib/gforge/chroot/scmrepos/darcs

Modified: trunk/gforge/plugins/scmdarcs/common/DarcsPlugin.class.php
===================================================================
--- trunk/gforge/plugins/scmdarcs/common/DarcsPlugin.class.php	2009-08-27 13:45:57 UTC (rev 8019)
+++ trunk/gforge/plugins/scmdarcs/common/DarcsPlugin.class.php	2009-08-27 13:46:07 UTC (rev 8020)
@@ -44,8 +44,29 @@
 		return $this->default_darcs_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 ' (Darcs: '.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 Darcs plugin is not fully implemented yet.</p>') ;
+		return _('<p>Documentation for Darcs is available <a href="http://darcs.net/">here</a>.</p>') ;
 	}
 
 	function getInstructionsForAnon ($project) {
@@ -183,16 +204,25 @@
 		$fname = '/etc/gforge/plugins/scmdarcs/config.py' ;
 
 		$f = fopen ($fname.'.new', 'w') ;
+
+		fwrite ($f, "class base:\n"
+			."\tdarcslogo = '".util_make_url ('/plugins/scmdarcs/darcsweb/darcs.png')."'\n"
+			."\tdarcsfav = '".util_make_url ('/plugins/scmdarcs/darcsweb/minidarcs.png')."'\n"
+			."\tcssfile = '".util_make_url ('/plugins/scmdarcs/darcsweb/style.css')."'\n"
+			. "\n") ;
+
 		foreach ($list as $project) {
 			$classname = str_replace ('-', '_',
 						  'repo_' . $project->getUnixName()) ;
 			
 			$repo = $this->darcs_root . '/' . $project->getUnixName() ;
-			fwrite ($f, "class: $classname\n"
-				."\treponame = $classname\n"
-			       ."\trepodir = $repo\n"
-				."\trepourl = " . util_make_url ('/anonscm/darcs/'.$project->getUnixName().'/') . "\n"
-				."\trepoprojurl = " . util_make_url ('/projects/'.$project->getUnixName().'/') . "\n"
+			fwrite ($f, "class $classname:\n"
+				."\treponame = '".$project->getUnixName()."'\n"
+				."\t".'repodesc = """'.$project->getPublicName().'"""'."\n"
+				."\trepodir = '$repo'\n"
+				."\trepourl = '" . util_make_url ('/anonscm/darcs/'.$project->getUnixName().'/') . "'\n"
+				."\trepoprojurl = '" . util_make_url ('/projects/'.$project->getUnixName().'/') . "'\n"
+				."\trepoencoding = 'utf8'\n"
 				. "\n") ;
 		}
 		fclose ($f) ;
@@ -280,7 +310,7 @@
 			$usr_updates = array () ;
 			$usr_deletes = array ();
 		
-			$repo = $this->svn_root . '/' . $project->getUnixName() ;
+			$repo = $this->darcs_root . '/' . $project->getUnixName() ;
 			if (!is_dir ($repo) || !is_dir ("$repo/_darcs")) {
 				echo "No repository\n" ;
 				db_rollback () ;
@@ -334,8 +364,6 @@
 			
 			xml_parser_free ($xml_parser);
 			
-			//..................
-		
 			// inserting group results in stats_cvs_groups
 		
 			if (!db_query_params ('INSERT INTO stats_cvs_group (month,day,group_id,checkouts,commits,adds) VALUES ($1,$2,$3,$4,$5,$6)',




More information about the Fusionforge-commits mailing list