[Fusionforge-commits] r6917 - trunk/gforge/plugins/scmbzr/common

Roland Mas lolando at libremir.placard.fr.eu.org
Wed Feb 4 18:06:06 CET 2009


Author: lolando
Date: 2009-02-04 18:06:06 +0100 (Wed, 04 Feb 2009)
New Revision: 6917

Modified:
   trunk/gforge/plugins/scmbzr/common/BzrPlugin.class.php
Log:
Convert createOrUpdateRepo() to hook and actually do something when called

Modified: trunk/gforge/plugins/scmbzr/common/BzrPlugin.class.php
===================================================================
--- trunk/gforge/plugins/scmbzr/common/BzrPlugin.class.php	2009-02-04 17:05:57 UTC (rev 6916)
+++ trunk/gforge/plugins/scmbzr/common/BzrPlugin.class.php	2009-02-04 17:06:06 UTC (rev 6917)
@@ -32,6 +32,7 @@
 		$this->hooks[] = 'scm_admin_page';
  		$this->hooks[] = 'scm_stats';
 		$this->hooks[] = 'scm_plugin';
+		$this->hooks[] = 'scm_createrepo';
 
 		require_once $gfconfig.'plugins/scmbzr/config.php' ;
 		
@@ -266,7 +267,9 @@
 		}
 	}
 
-	function createOrUpdateRepo ($group_id) {
+	function createOrUpdateRepo ($params) {
+		$group_id = $params['group_id'] ;
+
 		$project =& group_get_object($group_id);
 		if (!$project || !is_object($project)) {
 			return false;
@@ -277,8 +280,18 @@
 		if (! $project->usesPlugin ($this->name)) {
 			return false;
 		}
+
+		$repo = $this->bzr_root . '/' . $project->getUnixName() ;
+		$unix_group = 'scm_' . $project->getUnixName() ;
+		$pipe = popen ("bzr info $repo", "r") ;
+		$line = fgets ($pipe) ;
+		fclose ($pipe) ;
 		
-		
+		if (preg_match ("^Shared repository", $line) == 0) {
+			system ("bzr init-repo --no-trees $repo") ;
+		}
+		system ("chgrp -R $unix_group $repo") ;
+		system ("chmod -R g+wXs $repo") ;
 	}
   }
 




More information about the Fusionforge-commits mailing list