[Fusionforge-commits] r9955 - in trunk/gforge/plugins: scmarch/common scmbzr/common scmccase/common scmcvs/common scmdarcs/common scmgit/common scmhg/common

Roland Mas lolando at libremir.placard.fr.eu.org
Fri May 28 20:06:42 CEST 2010


Author: lolando
Date: 2010-05-28 20:06:42 +0200 (Fri, 28 May 2010)
New Revision: 9955

Modified:
   trunk/gforge/plugins/scmarch/common/ArchPlugin.class.php
   trunk/gforge/plugins/scmbzr/common/BzrPlugin.class.php
   trunk/gforge/plugins/scmccase/common/CCasePlugin.class.php
   trunk/gforge/plugins/scmcvs/common/CVSPlugin.class.php
   trunk/gforge/plugins/scmdarcs/common/DarcsPlugin.class.php
   trunk/gforge/plugins/scmgit/common/GitPlugin.class.php
   trunk/gforge/plugins/scmhg/common/HgPlugin.class.php
Log:
Switch rest of the SCM plugins to config API

Modified: trunk/gforge/plugins/scmarch/common/ArchPlugin.class.php
===================================================================
--- trunk/gforge/plugins/scmarch/common/ArchPlugin.class.php	2010-05-28 17:15:44 UTC (rev 9954)
+++ trunk/gforge/plugins/scmarch/common/ArchPlugin.class.php	2010-05-28 18:06:42 UTC (rev 9955)
@@ -21,6 +21,9 @@
  * USA
  */
 
+forge_define_config_item ('default_server', 'scmarch', forge_get_config ('web_host')) ;
+forge_define_config_item ('repos_path', 'scmarch', forge_get_config('chroot').'/scmrepos/arch') ;
+
 class ArchPlugin extends SCMPlugin {
 	function ArchPlugin () {
 		global $gfconfig;
@@ -29,20 +32,11 @@
 		$this->text = 'Arch';
 		$this->hooks[] = 'scm_generate_snapshots' ;
 
-		require_once $gfconfig.'plugins/scmarch/config.php' ;
-		
-		$this->default_arch_server = $default_arch_server ;
-		if (isset ($arch_root)) {
-			$this->arch_root = $arch_root;
-		} else {
-			$this->arch_root = forge_get_config('chroot').'/scmrepos/arch' ;
-		}
-
 		$this->register () ;
 	}
 	
 	function getDefaultServer() {
-		return $this->default_arch_server ;
+		return forge_get_config('default_server', 'scmarch') ;
 	}
 
 	function getBlurb () {
@@ -59,7 +53,7 @@
 			return false;
 		}
 
-		$repo = $this->arch_root . '/' . $project->getUnixName() ;
+		$repo = forge_get_config('repos_path', 'scmarch') . '/' . $project->getUnixName() ;
 		$unix_group = 'scm_' . $project->getUnixName() ;
 
 		$repo_exists = false ;
@@ -100,7 +94,7 @@
 			return false;
 		}
 
-		$toprepo = $this->arch_root ;
+		$toprepo = forge_get_config('repos_path', 'scmarch') ;
 		$repo = $toprepo . '/' . $project->getUnixName() ;
 
 		if (!is_dir ($repo) || !is_file ("$repo/format")) {

Modified: trunk/gforge/plugins/scmbzr/common/BzrPlugin.class.php
===================================================================
--- trunk/gforge/plugins/scmbzr/common/BzrPlugin.class.php	2010-05-28 17:15:44 UTC (rev 9954)
+++ trunk/gforge/plugins/scmbzr/common/BzrPlugin.class.php	2010-05-28 18:06:42 UTC (rev 9955)
@@ -21,6 +21,9 @@
  * USA
  */
 
+forge_define_config_item ('default_server', 'scmbzr', forge_get_config ('web_host')) ;
+forge_define_config_item ('repos_path', 'scmbzr', forge_get_config('chroot').'/scmrepos/bzr') ;
+
 class BzrPlugin extends SCMPlugin {
 	function BzrPlugin () {
 		global $gfconfig;
@@ -32,15 +35,6 @@
                 $this->hooks[] = 'scm_update_repolist' ;
                 $this->hooks[] = 'scm_gather_stats' ;
 
-		require_once $gfconfig.'plugins/scmbzr/config.php' ;
-		
-		$this->default_bzr_server = $default_bzr_server ;
-		if (isset ($bzr_root)) {
-			$this->bzr_root = $bzr_root;
-		} else {
-			$this->bzr_root = forge_get_config('chroot').'/scmrepos/bzr' ;
-		}
-
 		$this->main_branch_names = array () ;
 		$this->main_branch_names[] = 'trunk' ;
 		$this->main_branch_names[] = 'master' ;
@@ -52,7 +46,7 @@
 	}
 	
 	function getDefaultServer() {
-		return $this->default_bzr_server ;
+		return forge_get_config('default_server', 'scmbzr') ;
 	}
 
 	function printShortStats ($params) {
@@ -94,10 +88,10 @@
 			$u =& user_get_object(user_getid()) ;
 			$d = $u->getUnixName() ;
 			$b .= _('<p><b>Developer Bazaar Access via SSH</b></p><p>Only project developers can access the Bazaar branches via this method. SSH must be installed on your client machine. Enter your site password when prompted.</p>');
-			$b .= '<p><tt>bzr checkout bzr+ssh://'.$d.'@' . $project->getSCMBox() . $this->bzr_root .'/'. $project->getUnixName().'/'._('branchname').'</tt></p>' ;
+			$b .= '<p><tt>bzr checkout bzr+ssh://'.$d.'@' . $project->getSCMBox() . forge_get_config('repos_path', 'scmbzr') .'/'. $project->getUnixName().'/'._('branchname').'</tt></p>' ;
 		} else {
 			$b .= _('<p><b>Developer Bazaar Access via SSH</b></p><p>Only project developers can access the Bazaar branches via this method. SSH must be installed on your client machine. Substitute <i>developername</i> with the proper value. Enter your site password when prompted.</p>');
-			$b .= '<p><tt>bzr checkout bzr+ssh://<i>'._('developername').'</i>@' . $project->getSCMBox() . $this->bzr_root .'/'. $project->getUnixName().'/'._('branchname').'</tt></p>' ;
+			$b .= '<p><tt>bzr checkout bzr+ssh://<i>'._('developername').'</i>@' . $project->getSCMBox() . forge_get_config('repos_path', 'scmbzr') .'/'. $project->getUnixName().'/'._('branchname').'</tt></p>' ;
 		}
 		return $b ;
 	}
@@ -147,7 +141,7 @@
 			return false;
 		}
 
-		$repo = $this->bzr_root . '/' . $project->getUnixName() ;
+		$repo = forge_get_config('repos_path', 'scmbzr') . '/' . $project->getUnixName() ;
 		$unix_group = 'scm_' . $project->getUnixName() ;
 
 		$repo_exists = false ;
@@ -220,7 +214,7 @@
 			unlink ($dir . '/' . $del) ;
 		}
 		foreach ($createlist as $create) {
-			symlink ($this->bzr_root . '/' . $create, $dir . '/' . $create) ;
+			symlink (forge_get_config('repos_path', 'scmbzr') . '/' . $create, $dir . '/' . $create) ;
 		}
         }
 
@@ -251,7 +245,7 @@
 			$usr_updates = array () ;
 			$usr_adds = array () ;
 
-			$toprepo = $this->bzr_root ;
+			$toprepo = forge_get_config('repos_path', 'scmbzr') ;
 			$repo = $toprepo . '/' . $project->getUnixName() ;
 
 			$branch = $this->findMainBranch ($project) ;
@@ -387,7 +381,7 @@
         }
 
 	function findMainBranch ($project) {
-		$toprepo = $this->bzr_root ;
+		$toprepo = forge_get_config('repos_path', 'scmbzr') ;
 		$repo = $toprepo . '/' . $project->getUnixName() ;
 
 		$branch = '' ;
@@ -426,7 +420,7 @@
 			return false;
 		}
 
-		$toprepo = $this->bzr_root ;
+		$toprepo = forge_get_config('repos_path', 'scmbzr') ;
 		$repo = $toprepo . '/' . $project->getUnixName() ;
 
 		if (!is_dir ($repo) || !is_file ("$repo/format")) {

Modified: trunk/gforge/plugins/scmccase/common/CCasePlugin.class.php
===================================================================
--- trunk/gforge/plugins/scmccase/common/CCasePlugin.class.php	2010-05-28 17:15:44 UTC (rev 9954)
+++ trunk/gforge/plugins/scmccase/common/CCasePlugin.class.php	2010-05-28 18:06:42 UTC (rev 9955)
@@ -22,6 +22,9 @@
  * USA
  */
 
+forge_define_config_item ('default_server', 'scmccase', forge_get_config ('web_host')) ;
+forge_define_config_item ('tag_pattern', 'scmccase', '') ;
+
 class CCasePlugin extends SCMPlugin {
 	function CCasePlugin () {
 		global $gfconfig;
@@ -35,12 +38,6 @@
 		$this->hooks[] = "scm_createrepo";
 		$this->hooks[] = "scm_plugin";
 
-		require_once $gfconfig.'plugins/scmccase/config.php' ;
-		
-		$this->default_ccase_server = $default_ccase_server ;
-		$this->this_server = $this_server ;
-		$this->tag_pattern = $tag_pattern ;
-
 		$this->register () ;
 	}
 
@@ -79,7 +76,7 @@
 		$project =& group_get_object($group_id);
 		
 		if ($project->usesPlugin ("scmccase")) {
-			$vob_tag = ereg_replace ("GROUPNAME", $project->getUnixName (), $this->tag_pattern) ;
+			$vob_tag = ereg_replace ("GROUPNAME", $project->getUnixName (), forge_get_config('tag_pattern', 'scmccase')) ;
 	
 			print '<h2>ClearCase</h2>
 		                <p>Documentation for ClearCase is probably available somewhere.
@@ -173,14 +170,14 @@
 	
 
 	function GetDefaultServer () {
-		return $this->default_ccase_server ;
+		return forge_get_config('default_server', 'scmccase') ;
 	}
 
 	function GetGroupServer ($group_id) {
 		$res = db_query_params ('SELECT ccase_host FROM plugin_scmccase_group_usage WHERE group_id = $1',
 			array ($group_id));
 		if (db_numrows($res) == 0) {
-			return $this->default_ccase_server ;
+			return forge_get_config('default_server', 'scmccase') ;
 		} else {
 			return db_result($res,0,'ccase_host');
 		}

Modified: trunk/gforge/plugins/scmcvs/common/CVSPlugin.class.php
===================================================================
--- trunk/gforge/plugins/scmcvs/common/CVSPlugin.class.php	2010-05-28 17:15:44 UTC (rev 9954)
+++ trunk/gforge/plugins/scmcvs/common/CVSPlugin.class.php	2010-05-28 18:06:42 UTC (rev 9955)
@@ -21,6 +21,9 @@
  * USA
  */
 
+forge_define_config_item ('default_server', 'scmcvs', forge_get_config ('web_host')) ;
+forge_define_config_item ('repos_path', 'scmcvs', forge_get_config('chroot').'/scmrepos/cvs') ;
+
 class CVSPlugin extends SCMPlugin {
 	function CVSPlugin () {
 		global $cvs_root;
@@ -33,22 +36,11 @@
 		$this->hooks[] = 'scm_generate_snapshots' ;
 		$this->hooks[] = 'scm_gather_stats' ;
 
-		require_once $GLOBALS['gfconfig'].'plugins/scmcvs/config.php' ;
-
-		$this->default_cvs_server = $default_cvs_server ;
-		if ($cvs_root) {
-			$this->cvs_root = $cvs_root;
-		} elseif ($cvsdir_prefix) {
-			$this->cvs_root = $cvsdir_prefix;
-		} else {
-			$this->cvs_root = forge_get_config('chroot').'/scmrepos/cvs' ;
-		} 
-
 		$this->register () ;
 	}
 	
 	function getDefaultServer() {
-		return $this->default_cvs_server;
+		return forge_get_config('default_server', 'scmcvs');
 	}
 
 	function printShortStats ($params) {
@@ -77,7 +69,7 @@
 	}
 
 	function getInstructionsForAnon ($project) {
-		$cvsrootend = $project->getSCMBox().':'.$this->cvs_root.'/'.$project->getUnixName();
+		$cvsrootend = $project->getSCMBox().':'.forge_get_config('repos_path', 'scmcvs').'/'.$project->getUnixName();
 		$b = _('<p><b>Anonymous CVS Access</b></p><p>This project\'s CVS repository can be checked out through anonymous (pserver) CVS with the following instruction set. The module you wish to check out must be specified as the <i>modulename</i>. When prompted for a password for <i>anonymous</i>, simply press the Enter key.</p>');
 		$b .= '<p>
 		       <tt>cvs -d :pserver:anonymous@' . $cvsrootend.' login</tt><br/>
@@ -88,7 +80,7 @@
 	}
 
 	function getInstructionsForRW ($project) {
-		$cvsrootend = $project->getSCMBox().':'.$this->cvs_root.'/'.$project->getUnixName();
+		$cvsrootend = $project->getSCMBox().':'.forge_get_config('repos_path', 'scmcvs').'/'.$project->getUnixName();
 		if (session_loggedin()) {
 			$u =& user_get_object(user_getid()) ;
 			$d = $u->getUnixName() ;
@@ -199,8 +191,8 @@
 			return false;
 		}
 
-		$repo = $this->cvs_root . '/' . $project->getUnixName() ;
-		$locks_dir = $this->cvs_root . '/cvs-locks/' . $project->getUnixName() ;
+		$repo = forge_get_config('repos_path', 'scmcvs') . '/' . $project->getUnixName() ;
+		$locks_dir = forge_get_config('repos_path', 'scmcvs') . '/cvs-locks/' . $project->getUnixName() ;
 		$unix_group = 'scm_' . $project->getUnixName() ;
 
 		$repo_exists = false ;
@@ -242,7 +234,7 @@
 			$day_begin = gmmktime( 0, 0, 0, $month, $day, $year);
 			$day_end = $day_begin + 86400;
 			
-			$repo = $this->cvs_root . '/' . $project->getUnixName() ;
+			$repo = forge_get_config('repos_path', 'scmcvs') . '/' . $project->getUnixName() ;
 			if (!is_dir ($repo) || !is_dir ("$repo/CVSROOT")) {
 				echo "No repository\n" ;
 				db_rollback () ;
@@ -388,7 +380,7 @@
 			return false;
 		}
 
-		$toprepo = $this->cvs_root ;
+		$toprepo = forge_get_config('repos_path', 'scmcvs') ;
 		$repo = $toprepo . '/' . $project->getUnixName() ;
 
 		$repo_exists = false ;

Modified: trunk/gforge/plugins/scmdarcs/common/DarcsPlugin.class.php
===================================================================
--- trunk/gforge/plugins/scmdarcs/common/DarcsPlugin.class.php	2010-05-28 17:15:44 UTC (rev 9954)
+++ trunk/gforge/plugins/scmdarcs/common/DarcsPlugin.class.php	2010-05-28 18:06:42 UTC (rev 9955)
@@ -21,6 +21,9 @@
  * USA
  */
 
+forge_define_config_item ('default_server', 'scmdarcs', forge_get_config ('web_host')) ;
+forge_define_config_item ('repos_path', 'scmdarcs', forge_get_config('chroot').'/scmrepos/darcs') ;
+
 class DarcsPlugin extends SCMPlugin {
 	function DarcsPlugin () {
 		global $gfconfig;
@@ -32,20 +35,11 @@
 		$this->hooks[] = 'scm_browser_page' ;
 		$this->hooks[] = 'scm_gather_stats' ;
 		
-		require_once $gfconfig.'plugins/scmdarcs/config.php' ;
-		
-		$this->default_darcs_server = $default_darcs_server ;
-		if (isset ($darcs_root)) {
-			$this->darcs_root = $darcs_root;
-		} else {
-			$this->darcs_root = forge_get_config('chroot').'/scmrepos/darcs' ;
-		}
-		
 		$this->register () ;
 	}
 	
 	function getDefaultServer() {
-		return $this->default_darcs_server ;
+		return forge_get_config('default_server', 'scmdarcs') ;
 	}
 
 	function printShortStats ($params) {
@@ -83,7 +77,7 @@
 
 	function getInstructionsForRW ($project) {
 		$b = _('<p><b>Developer Darcs Access via SSH</b></p><p>Only project developers can access the Darcs tree via this method. SSH must be installed on your client machine. Substitute <i>developername</i> with the proper values. Enter your site password when prompted.</p>');
-		$b .= '<p><tt>darcs get '.$project->getSCMBox() . ':'. $this->darcs_root .'/'. $project->getUnixName().'/ .</tt></p>' ;
+		$b .= '<p><tt>darcs get '.$project->getSCMBox() . ':'. forge_get_config('repos_path', 'scmdarcs') .'/'. $project->getUnixName().'/ .</tt></p>' ;
 		return $b ;
 	}
 
@@ -179,7 +173,7 @@
 			return false;
 		}
 
-		$repo = $this->darcs_root . '/' . $project->getUnixName() ;
+		$repo = forge_get_config('repos_path', 'scmdarcs') . '/' . $project->getUnixName() ;
 		$unix_group = 'scm_' . $project->getUnixName() ;
 
 		if (!is_dir ($repo."/_darcs")) {
@@ -219,7 +213,7 @@
 			$classname = str_replace ('-', '_',
 						  'repo_' . $project->getUnixName()) ;
 			
-			$repo = $this->darcs_root . '/' . $project->getUnixName() ;
+			$repo = forge_get_config('repos_path', 'scmdarcs') . '/' . $project->getUnixName() ;
 			fwrite ($f, "class $classname:\n"
 				."\treponame = '".$project->getUnixName()."'\n"
 				."\t".'repodesc = """'.$project->getPublicName().'"""'."\n"
@@ -255,7 +249,7 @@
 			return false;
 		}
 
-		$toprepo = $this->darcs_root ;
+		$toprepo = forge_get_config('repos_path', 'scmdarcs') ;
 		$repo = $toprepo . '/' . $project->getUnixName() ;
 
 		if (!is_dir ($repo)) {
@@ -314,7 +308,7 @@
 			$usr_updates = array () ;
 			$usr_deletes = array ();
 		
-			$repo = $this->darcs_root . '/' . $project->getUnixName() ;
+			$repo = forge_get_config('repos_path', 'scmdarcs') . '/' . $project->getUnixName() ;
 			if (!is_dir ($repo) || !is_dir ("$repo/_darcs")) {
 				echo "No repository\n" ;
 				db_rollback () ;

Modified: trunk/gforge/plugins/scmgit/common/GitPlugin.class.php
===================================================================
--- trunk/gforge/plugins/scmgit/common/GitPlugin.class.php	2010-05-28 17:15:44 UTC (rev 9954)
+++ trunk/gforge/plugins/scmgit/common/GitPlugin.class.php	2010-05-28 18:06:42 UTC (rev 9955)
@@ -22,6 +22,9 @@
  * USA
  */
 
+forge_define_config_item ('default_server', 'scmgit', forge_get_config ('web_host')) ;
+forge_define_config_item ('repos_path', 'scmgit', forge_get_config('chroot').'/scmrepos/git') ;
+
 class GitPlugin extends SCMPlugin {
 	function GitPlugin () {
 		global $gfconfig;
@@ -33,20 +36,11 @@
 		$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 = forge_get_config('chroot').'/scmrepos/git' ;
-		}
-
 		$this->register () ;
 	}
 
 	function getDefaultServer() {
-		return $this->default_git_server ;
+		return forge_get_config('default_server', 'scmgit') ;
 	}
 
         function printShortStats ($params) {
@@ -107,10 +101,10 @@
 			$u =& user_get_object(user_getid()) ;
 			$d = $u->getUnixName() ;
 			$b = _('<p><b>Developer GIT Access via SSH</b></p><p>Only project developers can access the GIT tree via this method. SSH must be installed on your client machine. Enter your site password when prompted.</p>');
-			$b .= '<p><tt>git clone git+ssh://'.$d.'@' . $project->getSCMBox() . $this->git_root .'/'. $project->getUnixName() .'/'. $project->getUnixName() .'.git</tt></p>' ;
+			$b .= '<p><tt>git clone git+ssh://'.$d.'@' . $project->getSCMBox() . forge_get_config('repos_path', 'scmgit') .'/'. $project->getUnixName() .'/'. $project->getUnixName() .'.git</tt></p>' ;
 		} else {
 			$b = _('<p><b>Developer GIT Access via SSH</b></p><p>Only project developers can access the GIT tree via this method. SSH must be installed on your client machine. Substitute <i>developername</i> with the proper value. Enter your site password when prompted.</p>');
-		$b .= '<p><tt>git clone git+ssh://<i>'._('developername').'</i>@' . $project->getSCMBox() . $this->git_root .'/'. $project->getUnixName() .'/'. $project->getUnixName() .'.git</tt></p>' ;
+		$b .= '<p><tt>git clone git+ssh://<i>'._('developername').'</i>@' . $project->getSCMBox() . forge_get_config('repos_path', 'scmgit') .'/'. $project->getUnixName() .'/'. $project->getUnixName() .'.git</tt></p>' ;
 		}
 
 		if (session_loggedin()) {
@@ -121,7 +115,7 @@
 								  $u->getID())) ;
 				if ($result && db_numrows ($result) > 0) {
 					$b .= _('<p><b>Access to your personal repository</b></p><p>You have a personal repository for this project, accessible through SSH with the following method. Enter your site password when prompted.</p>');
-					$b .= '<p><tt>git clone git+ssh://'.$u->getUnixName().'@' . $project->getSCMBox() . $this->git_root .'/'. $project->getUnixName() .'/users/'. $u->getUnixName() .'.git</tt></p>' ;
+					$b .= '<p><tt>git clone git+ssh://'.$u->getUnixName().'@' . $project->getSCMBox() . forge_get_config('repos_path', 'scmgit') .'/'. $project->getUnixName() .'/users/'. $u->getUnixName() .'.git</tt></p>' ;
 				} else {
 					$glist = $u->getGroups();
 					foreach ($glist as $g) {
@@ -233,7 +227,7 @@
 		}
 
 		$project_name = $project->getUnixName() ;
-		$root = $this->git_root . '/' . $project_name ;
+		$root = forge_get_config('repos_path', 'scmgit') . '/' . $project_name ;
 		$unix_group = 'scm_' . $project_name ;
                 system ("mkdir -p $root") ;
 
@@ -315,7 +309,7 @@
 		$config_dir = '/etc/gforge/plugins/scmgit' ;
 		$fname = $config_dir . '/gitweb.conf' ;
 		$config_f = fopen ($fname.'.new', 'w') ;
-		$rootdir = $this->git_root;
+		$rootdir = forge_get_config('repos_path', 'scmgit');
 		fwrite($config_f, "\$projectroot = '$rootdir';\n");
 		fwrite($config_f, "\$projects_list = '$config_dir/gitweb.list';\n");
 		fwrite($config_f, "@git_base_url_list = ('". util_make_url ('/anonscm/git') . "');\n");
@@ -386,7 +380,7 @@
 		}
 
                 // TODO: ideally we generate one snapshot per git repository
-		$toprepo = $this->git_root ;
+		$toprepo = forge_get_config('repos_path', 'scmgit') ;
 		$repo = $toprepo . '/' . $project->getUnixName() . '/' .  $project->getUnixName() . '.git' ;
 
 		if (!is_dir ($repo)) {
@@ -442,7 +436,7 @@
 			$adds    = 0 ;
 			$updates = 0 ;
 
-			$repo = $this->git_root . '/' . $project->getUnixName() . '/' . $project->getUnixName() . '.git';
+			$repo = forge_get_config('repos_path', 'scmgit') . '/' . $project->getUnixName() . '/' . $project->getUnixName() . '.git';
 			if (!is_dir ($repo) || !is_dir ("$repo/refs")) {
 				// echo "No repository\n" ;
 				db_rollback () ;

Modified: trunk/gforge/plugins/scmhg/common/HgPlugin.class.php
===================================================================
--- trunk/gforge/plugins/scmhg/common/HgPlugin.class.php	2010-05-28 17:15:44 UTC (rev 9954)
+++ trunk/gforge/plugins/scmhg/common/HgPlugin.class.php	2010-05-28 18:06:42 UTC (rev 9955)
@@ -21,6 +21,9 @@
  * USA
  */
 
+forge_define_config_item ('default_server', 'scmhg', forge_get_config ('web_host')) ;
+forge_define_config_item ('repos_path', 'scmhg', forge_get_config('chroot').'/scmrepos/hg') ;
+
 class HgPlugin extends SCMPlugin {
 	function HgPlugin () {
 		global $gfconfig;
@@ -29,20 +32,11 @@
 		$this->text = 'Mercurial';
 		$this->hooks[] = 'scm_generate_snapshots' ;
 		
-		require_once $gfconfig.'plugins/scmhg/config.php' ;
-		
-		$this->default_hg_server = $default_hg_server ;
-		if (isset ($hg_root)) {
-			$this->hg_root = $hg_root;
-		} else {
-			$this->hg_root = forge_get_config('chroot').'/scmrepos/hg' ;
-		}
-		
 		$this->register () ;
 	}
 	
 	function getDefaultServer() {
-		return $this->default_hg_server ;
+		return forge_get_config('default_server', 'scmhg') ;
 	}
 
 	function getBlurb () {
@@ -62,11 +56,11 @@
 			$u =& user_get_object(user_getid()) ;
 			$d = $u->getUnixName() ;
 			$b = _('<p><b>Developer Mercurial Access via SSH</b></p><p>Only project developers can access the Mercurial tree via this method. SSH must be installed on your client machine. Enter your site password when prompted.</p>');
-			$b .= '<p><tt>hg clone ssh://'.$d.'@' . $project->getSCMBox() . $this->hg_root .'/'. $project->getUnixName().'/ .</tt></p>' ;
+			$b .= '<p><tt>hg clone ssh://'.$d.'@' . $project->getSCMBox() . forge_get_config('repos_path', 'scmhg') .'/'. $project->getUnixName().'/ .</tt></p>' ;
 		} else {
 			$d = '<i>developername</i>';
 			$b = _('<p><b>Developer Mercurial Access via SSH</b></p><p>Only project developers can access the Mercurial tree via this method. SSH must be installed on your client machine. Substitute <i>developername</i> with the proper value. Enter your site password when prompted.</p>');
-			$b .= '<p><tt>hg clone ssh://'.$d.'@' . $project->getSCMBox() . $this->hg_root .'/'. $project->getUnixName().'/ .</tt></p>' ;
+			$b .= '<p><tt>hg clone ssh://'.$d.'@' . $project->getSCMBox() . forge_get_config('repos_path', 'scmhg') .'/'. $project->getUnixName().'/ .</tt></p>' ;
 		}
 		return $b ;
 	}
@@ -93,7 +87,7 @@
 			return false;
 		}
 
-		$repo = $this->hg_root . '/' . $project->getUnixName() ;
+		$repo = forge_get_config('repos_path', 'scmhg') . '/' . $project->getUnixName() ;
 		$unix_group = 'scm_' . $project->getUnixName() ;
 
 		system ("mkdir -p $repo") ;
@@ -131,7 +125,7 @@
 			return false;
 		}
 
-		$toprepo = $this->hg_root ;
+		$toprepo = forge_get_config('repos_path', 'scmhg') ;
 		$repo = $toprepo . '/' . $project->getUnixName() ;
 
 		if (!is_dir ($repo)) {




More information about the Fusionforge-commits mailing list