[Fusionforge-commits] FusionForge branch master updated. v6.0.5-1404-gbec3256

Franck Villaume nerville at libremir.placard.fr.eu.org
Sun Jan 29 17:22:02 CET 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  bec32568c6d997da3906dc4637fdb03e7fbc2e9e (commit)
       via  fdd5b44ed0ab72caed72818a507f92a204bf3c0f (commit)
       via  982697a0894399b0c91c9dae99a4ba889baf5a9e (commit)
       via  8aca00b100aceeb8269050f1bb00763e37ff865a (commit)
       via  2aaffcfc303d7ad513eba279314fe5cf6082e988 (commit)
       via  851f8d50aa0bb8d4fef79502aa069ef520688a65 (commit)
       via  57032afc22892d72660cd5cdfad7aab1d5a3da79 (commit)
      from  002f0a0c559e022406bff1b904477f36ff56dc3b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=bec32568c6d997da3906dc4637fdb03e7fbc2e9e

commit bec32568c6d997da3906dc4637fdb03e7fbc2e9e
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun Jan 29 17:14:06 2017 +0100

    scmhg: disable secondary repo feature

diff --git a/src/plugins/scmhg/common/HgPlugin.class.php b/src/plugins/scmhg/common/HgPlugin.class.php
index 11d4d73..18da24a 100644
--- a/src/plugins/scmhg/common/HgPlugin.class.php
+++ b/src/plugins/scmhg/common/HgPlugin.class.php
@@ -43,9 +43,9 @@ Offer DAV or SSH access.");
 		$this->_addHook('scm_generate_snapshots');
 		$this->_addHook('scm_gather_stats');
 		$this->_addHook('activity');
-		$this->_addHook('scm_admin_form');
-		$this->_addHook('scm_delete_repo');
-		$this->_addHook('scm_add_repo');
+// 		$this->_addHook('scm_admin_form');
+// 		$this->_addHook('scm_delete_repo');
+// 		$this->_addHook('scm_add_repo');
 		$this->register();
 	}
 
@@ -690,161 +690,161 @@ Offer DAV or SSH access.");
 		return true;
 	}
 
-	function scm_add_repo(&$params) {
-		$project = $this->checkParams($params);
-		if (!$project) {
-			return false;
-		}
-		if (!$project->usesPlugin($this->name)) {
-			return false;
-		}
-
-		if (!isset($params['repo_name'])) {
-			return false;
-		}
-
-		if ($params['repo_name'] == $project->getUnixName()) {
-			$params['error_msg'] = sprintf(_('A repository %s already exists'), $params['repo_name']);
-			return false;
-		}
-
-		if (! util_is_valid_repository_name($params['repo_name'])) {
-			$params['error_msg'] = _('This repository name is not valid');
-			return false;
-		}
-
-		$result = db_query_params('SELECT count(*) AS count FROM scm_secondary_repos WHERE group_id=$1 AND repo_name = $2 AND plugin_id=$3',
-					  array($params['group_id'],
-						 $params['repo_name'],
-						 $this->getID()));
-		if (!$result) {
-			$params['error_msg'] = db_error();
-			return false;
-		}
-		if (db_result($result, 0, 'count')) {
-			$params['error_msg'] = sprintf(_('A repository %s already exists'), $params['repo_name']);
-			return false;
-		}
-
-		$description = '';
-		$clone = '';
-		if (isset($params['clone'])) {
-			$url = $params['clone'];
-			if ($url == '') {
-				// Start from empty
-				$clone = $url;
-			} elseif (preg_match('|^https?://|', $url)) {
-				// External URLs: OK
-				$clone = $url;
-			} elseif ($url == $project->getUnixName()) {
-				$clone = $url;
-			} elseif (($result = db_query_params('SELECT count(*) AS count FROM scm_secondary_repos WHERE group_id=$1 AND repo_name = $2 AND plugin_id=$3',
-							     array($project->getID(),
-								    $url,
-								    $this->getID())))
-				  && db_result($result, 0, 'count')) {
-				// Local repo: try to clone from an existing repo in same project
-				// Repository found
-				$clone = $url;
-			} else {
-				$params['error_msg'] = _('Invalid URL from which to clone');
-				$clone = '';
-				return false;
-			}
-		}
-		if (isset($params['description'])) {
-			$description = $params['description'];
-		}
-		if ($clone && !$description) {
-			$description = sprintf(_('Clone of %s'), $params['clone']);
-		}
-		if (!$description) {
-			$description = "Hg repository $params[repo_name] for project ".$project->getUnixName();
-		}
-
-		$result = db_query_params('INSERT INTO scm_secondary_repos (group_id, repo_name, description, clone_url, plugin_id) VALUES ($1, $2, $3, $4, $5)',
-					   array($params['group_id'],
-						  $params['repo_name'],
-						  $description,
-						  $clone,
-						  $this->getID()));
-		if (! $result) {
-			$params['error_msg'] = db_error();
-			return false;
-		}
-
-		plugin_hook('scm_admin_update', $params);
-		return true;
-	}
-
-	function scm_admin_form(&$params) {
-		global $HTML;
-		$project = $this->checkParams($params);
-		if (!$project) {
-			return false;
-		}
-		if (!$project->usesPlugin($this->name)) {
-			return false;
-		}
-
-		session_require_perm('project_admin', $params['group_id']);
-
-		$project_name = $project->getUnixName();
-		$result = db_query_params('SELECT repo_name, description, clone_url FROM scm_secondary_repos WHERE group_id=$1 AND next_action = $2 AND plugin_id=$3 ORDER BY repo_name',
-					  array($params['group_id'],
-						 SCM_EXTRA_REPO_ACTION_UPDATE,
-						 $this->getID()));
-		if (!$result) {
-			$params['error_msg'] = db_error();
-			return false;
-		}
-		$existing_repos = array();
-		while($data = db_fetch_array($result)) {
-			$existing_repos[] = array('repo_name' => $data['repo_name'],
-						  'description' => $data['description'],
-						  'clone_url' => $data['clone_url']);
-		}
-		if (count($existing_repos) == 0) {
-			echo $HTML->information(_('No extra Hg repository for project').' '.$project_name);
-		} else {
-			echo html_e('h2', array(), sprintf(ngettext('Extra Hg repository for project %1$s',
-									'Extra Hg repositories for project %1$s',
-									count($existing_repos)), $project_name));
-			$titleArr = array(_('Repository name'), ('Initial repository description'), _('Initial clone URL (if any)'), _('Delete'));
-			echo $HTML->listTableTop($titleArr);
-			foreach ($existing_repos as $key => $repo) {
-				$cells = array();
-				$cells[][] = html_e('tt', array(), $repo['repo_name']);
-				$cells[][] = $repo['description'];
-				$cells[][] = $repo['clone_url'];
-				$deleteForm = $HTML->openForm(array('name' => 'form_delete_repo_'.$repo['repo_name'], 'action' => getStringFromServer('PHP_SELF'), 'method' => 'post'));
-				$deleteForm .= html_e('input', array('type' => 'hidden', 'name' => 'group_id', 'value' => $params['group_id']));
-				$deleteForm .= html_e('input', array('type' => 'hidden', 'name' => 'delete_repository', 'value' => 1));
-				$deleteForm .= html_e('input', array('type' => 'hidden', 'name' => 'repo_name', 'value' => $repo['repo_name']));
-				$deleteForm .= html_e('input', array('type' => 'hidden', 'name' => 'scm_enable_anonymous', 'value' => ($project->enableAnonSCM()? 1 : 0)));
-				$deleteForm .= html_e('input', array('type' => 'submit', 'name' => 'submit', 'value' => _('Delete')));
-				$deleteForm .= $HTML->closeForm();
-				$cells[][] = $deleteForm;
-				echo $HTML->multiTableRow(array('class' => $HTML->boxGetAltRowStyle($key, true)), $cells);
-			}
-			echo $HTML->listTableBottom();
-		}
-
-		echo html_e('h2', array(), sprintf(_('Create new Hg repository for project %s'), $project_name));
-		echo $HTML->openForm(array('name' => 'form_create_repo', 'action' => getStringFromServer('PHP_SELF'), 'method' => 'post'));
-		echo html_e('input', array('type' => 'hidden', 'name' => 'group_id', 'value' => $params['group_id']));
-		echo html_e('input', array('type' => 'hidden', 'name' => 'create_repository', 'value' => 1));
-		echo html_e('p', array(), html_e('strong', array(), _('Repository name')._(':')).utils_requiredField().html_e('br').
-				html_e('input', array('type' => 'text', 'required' => 'required', 'size' => 20, 'name' => 'repo_name', 'value' => '')));
-		echo html_e('p', array(), html_e('strong', array(), _('Description')._(':')).html_e('br').
-				html_e('input', array('type' => 'text', 'size' => 60, 'name' => 'description', 'value' => '')));
-		echo html_e('p', array(), html_e('strong', array(), _('Initial clone URL (or name of an existing repository in this project; leave empty to start with an empty repository)')._(':')).html_e('br').
-				html_e('input', array('type' => 'text', 'size' => 60, 'name' => 'clone', 'value' => $project_name)));
-		echo html_e('input', array('type' => 'hidden', 'name' => 'scm_enable_anonymous', 'value' => ($project->enableAnonSCM()? 1 : 0)));
-		echo html_e('input', array('type' => 'submit', 'name' => 'cancel', 'value' => _('Cancel')));
-		echo html_e('input', array('type' => 'submit', 'name' => 'submit', 'value' => _('Submit')));
-		echo $HTML->closeForm();
-	}
+// 	function scm_add_repo(&$params) {
+// 		$project = $this->checkParams($params);
+// 		if (!$project) {
+// 			return false;
+// 		}
+// 		if (!$project->usesPlugin($this->name)) {
+// 			return false;
+// 		}
+//
+// 		if (!isset($params['repo_name'])) {
+// 			return false;
+// 		}
+//
+// 		if ($params['repo_name'] == $project->getUnixName()) {
+// 			$params['error_msg'] = sprintf(_('A repository %s already exists'), $params['repo_name']);
+// 			return false;
+// 		}
+//
+// 		if (! util_is_valid_repository_name($params['repo_name'])) {
+// 			$params['error_msg'] = _('This repository name is not valid');
+// 			return false;
+// 		}
+//
+// 		$result = db_query_params('SELECT count(*) AS count FROM scm_secondary_repos WHERE group_id=$1 AND repo_name = $2 AND plugin_id=$3',
+// 					  array($params['group_id'],
+// 						 $params['repo_name'],
+// 						 $this->getID()));
+// 		if (!$result) {
+// 			$params['error_msg'] = db_error();
+// 			return false;
+// 		}
+// 		if (db_result($result, 0, 'count')) {
+// 			$params['error_msg'] = sprintf(_('A repository %s already exists'), $params['repo_name']);
+// 			return false;
+// 		}
+//
+// 		$description = '';
+// 		$clone = '';
+// 		if (isset($params['clone'])) {
+// 			$url = $params['clone'];
+// 			if ($url == '') {
+// 				// Start from empty
+// 				$clone = $url;
+// 			} elseif (preg_match('|^https?://|', $url)) {
+// 				// External URLs: OK
+// 				$clone = $url;
+// 			} elseif ($url == $project->getUnixName()) {
+// 				$clone = $url;
+// 			} elseif (($result = db_query_params('SELECT count(*) AS count FROM scm_secondary_repos WHERE group_id=$1 AND repo_name = $2 AND plugin_id=$3',
+// 							     array($project->getID(),
+// 								    $url,
+// 								    $this->getID())))
+// 				  && db_result($result, 0, 'count')) {
+// 				// Local repo: try to clone from an existing repo in same project
+// 				// Repository found
+// 				$clone = $url;
+// 			} else {
+// 				$params['error_msg'] = _('Invalid URL from which to clone');
+// 				$clone = '';
+// 				return false;
+// 			}
+// 		}
+// 		if (isset($params['description'])) {
+// 			$description = $params['description'];
+// 		}
+// 		if ($clone && !$description) {
+// 			$description = sprintf(_('Clone of %s'), $params['clone']);
+// 		}
+// 		if (!$description) {
+// 			$description = "Hg repository $params[repo_name] for project ".$project->getUnixName();
+// 		}
+//
+// 		$result = db_query_params('INSERT INTO scm_secondary_repos (group_id, repo_name, description, clone_url, plugin_id) VALUES ($1, $2, $3, $4, $5)',
+// 					   array($params['group_id'],
+// 						  $params['repo_name'],
+// 						  $description,
+// 						  $clone,
+// 						  $this->getID()));
+// 		if (! $result) {
+// 			$params['error_msg'] = db_error();
+// 			return false;
+// 		}
+//
+// 		plugin_hook('scm_admin_update', $params);
+// 		return true;
+// 	}
+
+// 	function scm_admin_form(&$params) {
+// 		global $HTML;
+// 		$project = $this->checkParams($params);
+// 		if (!$project) {
+// 			return false;
+// 		}
+// 		if (!$project->usesPlugin($this->name)) {
+// 			return false;
+// 		}
+//
+// 		session_require_perm('project_admin', $params['group_id']);
+//
+// 		$project_name = $project->getUnixName();
+// 		$result = db_query_params('SELECT repo_name, description, clone_url FROM scm_secondary_repos WHERE group_id=$1 AND next_action = $2 AND plugin_id=$3 ORDER BY repo_name',
+// 					  array($params['group_id'],
+// 						 SCM_EXTRA_REPO_ACTION_UPDATE,
+// 						 $this->getID()));
+// 		if (!$result) {
+// 			$params['error_msg'] = db_error();
+// 			return false;
+// 		}
+// 		$existing_repos = array();
+// 		while($data = db_fetch_array($result)) {
+// 			$existing_repos[] = array('repo_name' => $data['repo_name'],
+// 						  'description' => $data['description'],
+// 						  'clone_url' => $data['clone_url']);
+// 		}
+// 		if (count($existing_repos) == 0) {
+// 			echo $HTML->information(_('No extra Hg repository for project').' '.$project_name);
+// 		} else {
+// 			echo html_e('h2', array(), sprintf(ngettext('Extra Hg repository for project %1$s',
+// 									'Extra Hg repositories for project %1$s',
+// 									count($existing_repos)), $project_name));
+// 			$titleArr = array(_('Repository name'), ('Initial repository description'), _('Initial clone URL (if any)'), _('Delete'));
+// 			echo $HTML->listTableTop($titleArr);
+// 			foreach ($existing_repos as $key => $repo) {
+// 				$cells = array();
+// 				$cells[][] = html_e('tt', array(), $repo['repo_name']);
+// 				$cells[][] = $repo['description'];
+// 				$cells[][] = $repo['clone_url'];
+// 				$deleteForm = $HTML->openForm(array('name' => 'form_delete_repo_'.$repo['repo_name'], 'action' => getStringFromServer('PHP_SELF'), 'method' => 'post'));
+// 				$deleteForm .= html_e('input', array('type' => 'hidden', 'name' => 'group_id', 'value' => $params['group_id']));
+// 				$deleteForm .= html_e('input', array('type' => 'hidden', 'name' => 'delete_repository', 'value' => 1));
+// 				$deleteForm .= html_e('input', array('type' => 'hidden', 'name' => 'repo_name', 'value' => $repo['repo_name']));
+// 				$deleteForm .= html_e('input', array('type' => 'hidden', 'name' => 'scm_enable_anonymous', 'value' => ($project->enableAnonSCM()? 1 : 0)));
+// 				$deleteForm .= html_e('input', array('type' => 'submit', 'name' => 'submit', 'value' => _('Delete')));
+// 				$deleteForm .= $HTML->closeForm();
+// 				$cells[][] = $deleteForm;
+// 				echo $HTML->multiTableRow(array('class' => $HTML->boxGetAltRowStyle($key, true)), $cells);
+// 			}
+// 			echo $HTML->listTableBottom();
+// 		}
+
+// 		echo html_e('h2', array(), sprintf(_('Create new Hg repository for project %s'), $project_name));
+// 		echo $HTML->openForm(array('name' => 'form_create_repo', 'action' => getStringFromServer('PHP_SELF'), 'method' => 'post'));
+// 		echo html_e('input', array('type' => 'hidden', 'name' => 'group_id', 'value' => $params['group_id']));
+// 		echo html_e('input', array('type' => 'hidden', 'name' => 'create_repository', 'value' => 1));
+// 		echo html_e('p', array(), html_e('strong', array(), _('Repository name')._(':')).utils_requiredField().html_e('br').
+// 				html_e('input', array('type' => 'text', 'required' => 'required', 'size' => 20, 'name' => 'repo_name', 'value' => '')));
+// 		echo html_e('p', array(), html_e('strong', array(), _('Description')._(':')).html_e('br').
+// 				html_e('input', array('type' => 'text', 'size' => 60, 'name' => 'description', 'value' => '')));
+// 		echo html_e('p', array(), html_e('strong', array(), _('Initial clone URL (or name of an existing repository in this project; leave empty to start with an empty repository)')._(':')).html_e('br').
+// 				html_e('input', array('type' => 'text', 'size' => 60, 'name' => 'clone', 'value' => $project_name)));
+// 		echo html_e('input', array('type' => 'hidden', 'name' => 'scm_enable_anonymous', 'value' => ($project->enableAnonSCM()? 1 : 0)));
+// 		echo html_e('input', array('type' => 'submit', 'name' => 'cancel', 'value' => _('Cancel')));
+// 		echo html_e('input', array('type' => 'submit', 'name' => 'submit', 'value' => _('Submit')));
+// 		echo $HTML->closeForm();
+// 	}
 
 }
 

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=fdd5b44ed0ab72caed72818a507f92a204bf3c0f

commit fdd5b44ed0ab72caed72818a507f92a204bf3c0f
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun Jan 29 16:48:53 2017 +0100

    scmhg: rewrite to fit with 6.0. currently only support SSH and online browsing

diff --git a/src/plugins/scmhg/common/HgPlugin.class.php b/src/plugins/scmhg/common/HgPlugin.class.php
index 89af2bc..11d4d73 100644
--- a/src/plugins/scmhg/common/HgPlugin.class.php
+++ b/src/plugins/scmhg/common/HgPlugin.class.php
@@ -76,9 +76,7 @@ Offer DAV or SSH access.");
 		if (forge_get_config('use_dav', 'scmhg')) {
 			$protocol = forge_get_config('use_ssl', 'scmhg')? 'https' : 'http';
 			$b .= html_e('p', array(), _("This project's Mercurial repository can be checked out through anonymous access with the following command")._(':'));
-			$b .= html_e('p', array(), html_e('tt', array(), 'hg clone '.$protocol.'://'.forge_get_config('anonhg_login', 'scmhg').'@'.$this->getBoxForProject($project).'/'.'hg'.'/'.$project->getUnixName().'/').
-						html_e('br').
-						_('The password is ').forge_get_config('anonhg_password', 'scmhg'));
+			$b .= html_e('p', array(), html_e('tt', array(), 'hg clone '.$protocol.'://'.forge_get_config('scm_host').'/anonscm/'.'hg'.'/'.$project->getUnixName()));
 		} else {
 			$b .= $HTML->warning_msg(_('Please contact forge administrator, scmhg plugin is not correctly configured'));
 		}
@@ -86,44 +84,97 @@ Offer DAV or SSH access.");
 	}
 
 	function getInstructionsForRW($project) {
-		$protocol = forge_get_config('use_ssl', 'scmhg')? 'https' : 'http';
+		$repo_list = array($project->getUnixName());
+
+		$result = db_query_params('SELECT repo_name FROM scm_secondary_repos WHERE group_id=$1 AND next_action = $2 AND plugin_id=$3 ORDER BY repo_name',
+					   array($project->getID(),
+						  SCM_EXTRA_REPO_ACTION_UPDATE,
+						  $this->getID()));
+		$rows = db_numrows($result);
+		for ($i=0; $i<$rows; $i++) {
+			$repo_list[] = db_result($result, $i, 'repo_name');
+		}
+		$b = '';
+		$b .= html_e('h2', array(), _('Developer Access'));
+		$b .= html_e('p', array(),
+				ngettext('Only project developers can access the Hg repository via this method.',
+				'Only project developers can access the Hg repositories via this method.',
+				count($repo_list)));
+		$b .= '<div id="tabber">';
+		$b .= '<ul>';
+		if (forge_get_config('use_ssh', 'scmhg')) {
+			$b .= '<li><a href="#tabber-ssh">'._('via SSH').'</a></li>';
+			$configuration = 1;
+		}
+		if (forge_get_config('use_dav', 'scmhg')) {
+			$b .= '<li><a href="#tabber-dav">'._('via "DAV"').'</a></li>';
+			$configuration = 1;
+		}
+		$b .= '</ul>';
+		if (!isset($configuration)) {
+			return $HTML->error_msg(_('Error')._(': ')._('No access protocol has been allowed for the Hg plugin in scmhg.ini: use_ssh and use_dav are disabled'));
+		}
 		if (session_loggedin()) {
 			$u = user_get_object(user_getid());
 			$d = $u->getUnixName();
-			$b = '';
 			if (forge_get_config('use_ssh', 'scmhg')) {
-				$b .= html_e('h2', array(), sprintf(_('Developer %s Access via SSH'), 'Mercurial'));
-				$b .= html_e('p', array(), _('Read/write access to Mercurial tree is allowed for authenticated users.').
-					' '._('SSH must be installed on your client machine.').
-					' '._('Enter your site password when prompted.'));
-				// Warning : the ssh uri MUST be this form : ssh://username@scmbox//path/reponame
-				//            HAVE YOU SEEN THE // starting the path ? Keep in mind the double /
-				$b .= html_e('p', array(), html_e('tt', array(), 'hg clone ssh://'.$d.'@'.$this->getBoxForProject($project).'/'.forge_get_config('repos_path', 'scmhg').'/'.$project->getUnixName()));
+				$b .= '<div id="tabber-ssh" class="tabbertab" >';
+				$b .= html_e('p', array(), _('SSH must be installed on your client machine.'));
+				$htmlRepo = '';
+				foreach ($repo_list as $repo_name) {
+					// Warning : the ssh uri MUST be this form : ssh://username@scmbox//path/reponame
+					//           HAVE YOU SEEN THE // starting the path ? Keep in mind the double /
+					$htmlRepo .= html_e('tt', array(), 'hg clone ssh://'.$d.'@'.forge_get_config('scm_host').'/'.forge_get_config('repos_path', 'scmhg').'/'.$project->getUnixName()).html_e('br');
+				}
+				$b .= html_e('p', array(), $htmlRepo);
+				$b .= '</div>';
 			}
 			if (forge_get_config('use_dav', 'scmhg')) {
-				$b .= html_e('h2', array(), _('Developer Mercurial Access via HTTP'));
-				$b .= html_e('p', array(), _('Only project developers can access the Mercurial tree via this method.').
-					' '._('Enter your site password when prompted.'));
-				$b .= html_e('p', array(), html_e('tt', array(), 'hg clone '.$protocol.'://<i>'.$d.'</i>@'.$this->getBoxForProject($project) .'/hg/'. $project->getUnixName()));
+				$b .= '<div id="tabber-dav" class="tabbertab" >';
+				$b .= html_e('p', array(), _('Enter your site password when prompted.'));
+				$htmlRepo = '';
+				$protocol = forge_get_config('use_ssl', 'scmhg') ? 'https' : 'http';
+				foreach ($repo_list as $repo_name) {
+					$htmlRepo .= html_e('tt', array(), 'hg clone '.$protocol.'://<i>'.$d.'</i>@'.forge_get_config('scm_host').'/authscm/'.$d.'/hg/'. $project->getUnixName()).html_e('br');
+				}
+				$b .= html_e('p', array(), $htmlRepo);
+				$b .= '</div>';
 			}
 		} else {
 			if (forge_get_config('use_ssh', 'scmhg')) {
-				$d = html_e('em', array(), _('developername'));
-				$b = html_e('h2', array(), sprintf(_('Developer %s Access via SSH'), 'Mercurial'));
-				$b .= html_e('p', array(), sprintf(_('Only project developers can access the %s tree via this method.'), 'Mercurial').
-						' '._('SSH must be installed on your client machine.').
-						' '._('Substitute <em>developername</em> with the proper value.').
-						' '._('Enter your site password when prompted.'));
-				// Warning : the ssh uri MUST be this form : ssh://username@scmbox//path/reponame
-				//            HAVE YOU SEEN THE // starting the path ? Keep in mind the double /
-				$b .= html_e('p', array(), html_e('tt', array(), 'hg clone ssh://'.$d.'@'.$this->getBoxForProject($project).'/'.forge_get_config('repos_path', 'scmhg').'/'.$project->getUnixName()));
-			} else {
-				$b = html_e('h2', array(), _('Developer Mercurial Access via HTTP'));
-				$b .= html_e('p', array(), _('Only project developers can access the Mercurial tree via this method.').
-					' '._('Enter your site password when prompted.'));
-				$b .= html_e('p', array(), html_e('tt', array(), 'hg clone '.$protocol.'://'.html_e('i', array(), _('developername')).'@'.$this->getBoxForProject($project).'/hg/'.$project->getUnixName()));
+				$b .= '<div id="tabber-ssh" class="tabbertab" >';
+				$b .= html_e('p', array(),
+					ngettext('Only project developers can access the Hg repository via this method.',
+						'Only project developers can access the Hg repositories via this method.',
+						count($repo_list)).
+					' '. _('SSH must be installed on your client machine.').
+					' '. _('Substitute <em>developername</em> with the proper value.'));
+				$htmlRepo = '';
+				foreach ($repo_list as $repo_name) {
+					// Warning : the ssh uri MUST be this form : ssh://username@scmbox//path/reponame
+					//           HAVE YOU SEEN THE // starting the path ? Keep in mind the double /
+					$htmlRepo .= html_e('tt', array(), 'hg clone ssh://'.$d.'@'.forge_get_config('scm_host').'/'.forge_get_config('repos_path', 'scmhg').'/'.$project->getUnixName()).html_e('br');
+				}
+				$b .= html_e('p', array(), $htmlRepo);
+				$b .= '</div>';
+			}
+			if (forge_get_config('use_dav', 'scmhg')) {
+				$protocol = forge_get_config('use_ssl', 'scmhg')? 'https' : 'http';
+				$b .= '<div id="tabber-dav" class="tabbertab" >';
+				$b .= html_e('p', array(),
+					ngettext('Only project developers can access the Hg repository via this method.',
+						'Only project developers can access the Hg repositories via this method.',
+						count($repo_list)).
+					' '. _('Enter your site password when prompted.'));
+				$htmlRepo = '';
+				foreach ($repo_list as $repo_name) {
+					$htmlRepo .= html_e('tt', array(), 'hg clone '.$protocol.'://'.html_e('i', array(), _('developername')).'@'.forge_get_config('scm_host').'/authscm/'.html_e('i', array(), _('developername')).'/hg/'.$project->getUnixName()).html_e('br');
+				}
+				$b .= html_e('p', array(), $htmlRepo);
+				$b .= '</div>';
 			}
 		}
+		$b .= '</div>';
 		return $b;
 	}
 
@@ -208,66 +259,70 @@ Offer DAV or SSH access.");
 		}
 		if ($project->usesPlugin($this->name)) {
 			if ($this->browserDisplayable($project)) {
-				$iframesrc = '/plugins/scmhg/cgi-bin/'.$project->getUnixName().'.cgi';
+				$protocol = forge_get_config('use_ssl', 'scmgit')? 'https' : 'http';
+				$box = forge_get_config('scm_host');
+				$iframesrc = $protocol.'://'.$box.'/plugins/scmhg/cgi-bin/'.$project->getUnixName().'.cgi';
 				if ($params['commit']) {
 					$iframesrc .= '/rev/'.$params['commit'];
 				} else {
 					$iframesrc .=  '?p='.$project->getUnixName();
 				}
-				htmlIframe($iframesrc,array('id'=>'scmhg_iframe'));
+				htmlIframe($iframesrc,array('id'=>'scmhg_iframe', 'absolute'=>true));
 			}
 		}
 	}
 
 	function createOrUpdateRepo($params) {
 		$project = $this->checkParams($params);
-		if (!$project) {
-			return false;
-		}
+		if (!$project) return false;
+		if (!$project->isActive()) return false;
+		if (!$project->usesPlugin($this->name)) return false;
 
-		if (!$project->usesPlugin($this->name)) {
-			return false;
-		}
+		$project_name = $project->getUnixName();
+		$unix_group_ro = $project_name . '_scmro';
+		$unix_group_rw = $project_name . '_scmrw';
 
-		$repo = forge_get_config('repos_path', 'scmhg') . '/' . $project->getUnixName();
-		if (forge_get_config('use_ssh', 'scmhg')) {
-			$unix_group = 'scm_' . $project->getUnixName();
+		$repo = forge_get_config('repos_path', 'scmhg') . '/' . $project_name;
+		$root = forge_get_config('repos_path', 'scmhg') . '/' . $project_name;
+		if (!is_dir($root)) {
+			system("mkdir -p $root");
+			system("chgrp $unix_group_ro $root");
 		}
-		if (forge_get_config('use_dav', 'scmhg')) {
-			$unix_group = forge_get_config('apache_group');
-			$unix_user = forge_get_config('apache_user');
+		if ($project->enableAnonSCM()) {
+			system("chmod 2755 $root");
+		} else {
+			system("chmod 2750 $root");
 		}
 
-		system("mkdir -p $repo");
 		/** per project configuration for http **/
-		if (forge_get_config('use_dav', 'scmhg')) {
-			//get template hgweb.cgi
-			$hgweb = forge_get_config('source_path').'/plugins/scmhg/www/cgi-bin/hgweb.cgi';
-			$project_hgweb = forge_get_config('source_path').'/www/plugins/scmhg/cgi-bin/'.$project->getUnixName().'.cgi';
-			if (!is_file($project_hgweb)) {
-				$lines = file($hgweb);
-				$repo_config = "";
-				foreach ($lines as $line) {
-					if (preg_match("/\Aapplication = hgweb/",$line)) {
-						//link per project hgweb.cgi to the project repository
-						$repo_config .= "application = hgweb(\"".$repo."\",\"".$project->getUnixName()."\")\n";
-					} else {
-						$repo_config .= $line;
-					}
+		//get template hgweb.cgi
+		$hgweb = forge_get_config('source_path').'/plugins/scmhg/cgi-bin/hgweb.cgi';
+		$project_hgweb = forge_get_config('source_path').'/www/plugins/scmhg/cgi-bin/'.$project_name.'.cgi';
+		if (!is_file($project_hgweb)) {
+			$lines = file($hgweb);
+			$repo_config = "";
+			foreach ($lines as $line) {
+				if (preg_match("/\Aapplication = hgweb/",$line)) {
+					//link per project hgweb.cgi to the project repository
+					$repo_config .= "application = hgweb(\"".$root."\",\"".$project_name."\")\n";
+				} else {
+					$repo_config .= $line;
 				}
-				$f = fopen($project_hgweb, 'w');
-				fwrite($f, $repo_config);
-				fclose($f);
-				system("chown $unix_user:$unix_group $project_hgweb");
-				system("chmod u+x $project_hgweb");
 			}
-		}
-		if (!is_dir("$repo/.hg")) {
-			system("hg init $repo");
-			$f = fopen("$repo/.hg/hgrc",'w');
+			$f = fopen($project_hgweb, 'w');
+			fwrite($f, $repo_config);
+			fclose($f);
+			$apache_user = forge_get_config('apache_user');
+			$apache_group = forge_get_config('apache_group');
+			system("chgrp $apache_user:$apache_group $project_hgweb");
+			system("chmod u+x $project_hgweb");
+		}
+		if (!is_dir("$root/.hg")) {
+			system("hg init $root");
+			$f = fopen("$root/.hg/hgrc",'w');
 			$conf = "[web]\n";
 			$conf .= "baseurl = /hg";
-			$conf .= "\ndescription = ".$project->getUnixName();
+			$conf .= "\ndescription = ".$project_name;
 			$conf .= "\nstyle = paper";
 			$conf .= "\nallow_push = *"; // every user (see Apache configuration) is allowed to push
 			$conf .= "\nallow_read = *"; // every user is allowed to clone and pull
@@ -276,36 +331,25 @@ Offer DAV or SSH access.");
 			}
 			fwrite($f, $conf);
 			fclose($f);
-			system("chgrp -R $unix_group $repo");
-			system("chmod 770 $repo");
-			system("find $repo -type d | xargs chmod g+s");
-			system("chmod 660 $repo/.hg/hgrc");
-		}
-
-		if ($project->enableAnonSCM()) {
-			system("chmod -R g+wX,o+rX-w $repo");
-		} else {
-			system("chmod -R g+wX,o-rwx $repo");
+			//system("chmod 770 $root");
+			//system("find $root -type d | xargs chmod g+s");
+			system("chgrp -R $unix_group_rw $root");
+			system("chmod -R g=rwX,o=rX $root");
+			system("chmod 660 $root/.hg/hgrc");
 		}
 	}
 
 	function updateRepositoryList($params) {
 		$groups = $this->getGroups();
-		if (!forge_get_config('use_dav', 'scmhg')) {
-			return true;
-		}
-
 		$unix_group = forge_get_config('apache_group');
 		$unix_user = forge_get_config('apache_user');
 		$password_data = '';
 		$hgusers = array();
 		foreach ($groups as $project) {
-			if (!$project->isActive()) {
-				continue;
-			}
-			if (!$project->usesSCM()) {
-				continue;
-			}
+			if (!$project->isActive()) continue;
+			if (!$project->usesSCM()) continue;
+			if (!$project->usesPlugin($this->name)) continue;
+
 			$push = "";
 			$read = ""; /*pull,clone*/
 			$path = forge_get_config('repos_path', 'scmhg').'/'.$project->getUnixName().'/.hg';
@@ -314,10 +358,7 @@ Offer DAV or SSH access.");
 			$users = $project->getMembers();
 			$pname = $project->getUnixName();
 			foreach ($users as $user) {
-				if (forge_check_perm_for_user ($user,
-							'scm',
-							$project->getID(),
-							'write')) {
+				if (forge_check_perm_for_user ($user, 'scm', $project->getID(), 'write')) {
 					if ($prevp){
 						$push .= ", ";
 					}
@@ -329,10 +370,7 @@ Offer DAV or SSH access.");
 					$prevp = true;
 					$prevr = true;
 					$hgusers[$user->getID()] = $user;
-				}elseif (forge_check_perm_for_user ($user,
-									'scm',
-									$project->getID(),
-									'read')) {
+				} elseif (forge_check_perm_for_user ($user, 'scm', $project->getID(), 'read')) {
 					if ($prevr){
 						$read .= ", ";
 					}

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=982697a0894399b0c91c9dae99a4ba889baf5a9e

commit 982697a0894399b0c91c9dae99a4ba889baf5a9e
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun Jan 29 16:47:45 2017 +0100

    scmhg: initial configuration to support online browsing, anonymous clone

diff --git a/src/plugins/scmhg/etc/httpd.conf.d/vhost-scm-plugin-scmhg.inc b/src/plugins/scmhg/etc/httpd.conf.d/vhost-scm-plugin-scmhg.inc
new file mode 100644
index 0000000..296dd61
--- /dev/null
+++ b/src/plugins/scmhg/etc/httpd.conf.d/vhost-scm-plugin-scmhg.inc
@@ -0,0 +1,16 @@
+<Directory ${FF__scmhg__repos_path}>
+  Include ${FF__core__config_path}/httpd.conf.d/disable-scripts.inc
+</Directory>
+
+ScriptAlias /plugins/scmhg/cgi-bin/ ${FF__core__plugins_path}/scmhg/www/cgi-bin/
+AliasMatch ^/authscm/[^/]+/hg/(.*) ${FF__scmhg__repos_path}/$1
+AliasMatch ^/anonscm/[^/]+/hg/(.*) ${FF__scmhg__repos_path}/$1
+
+<Directory ${FF__core__plugins_path}/scmhg/www/cgi-bin >
+	Options +ExecCGI +FollowSymLinks +Multiviews
+	AddHandler cgi-script .cgi
+	RewriteEngine On
+	RewriteRule .* - [E=REMOTE_USER:%{ENV:REDIRECT_REMOTE_USER}]
+	AllowOverride None
+	Require all granted
+</Directory>

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=8aca00b100aceeb8269050f1bb00763e37ff865a

commit 8aca00b100aceeb8269050f1bb00763e37ff865a
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun Jan 29 16:46:38 2017 +0100

    fix install.sh script to support browsing + template format log

diff --git a/src/plugins/scmhg/bin/install.sh b/src/plugins/scmhg/bin/install.sh
index c68ac8e..c457b29 100644
--- a/src/plugins/scmhg/bin/install.sh
+++ b/src/plugins/scmhg/bin/install.sh
@@ -1,21 +1,25 @@
 #!/bin/bash -e
-# hgweb post-install
+# scmhg post-install
 
 source $(forge_get_config source_path)/post-install.d/common/service.inc
 
 plugindir=$(forge_get_config plugins_path)/scmhg
 hgwebcgi=$(ls /usr/share/doc/mercurial-*/hgweb.cgi 2>/dev/null | tail -1)
 hgwebdir=$(ls -d /usr/share/doc/mercurial-* 2>/dev/null | tail -1)
+hgtemplatesdir=$(ls -d /usr/lib*/python*/site-packages/mercurial/templates 2>/dev/null | tail -1)
 
 case "$1" in
     configure)
 	# hgweb
-	if [ -z "$hgwebcgi" -o -z "$hgwebdir" ]; then echo "Cannot find gitweb"; exit 1; fi
+	if [ -z "$hgwebcgi" -o -z "$hgwebdir" ]; then echo "Cannot find hgweb"; exit 1; fi
 	mkdir -p -m 755 $plugindir/cgi-bin/
+	mkdir -p -m 755 $plugindir/www/cgi-bin/
 	ln -nfs $hgwebcgi                 $plugindir/cgi-bin/
+	ln -nfs $plugindir/etc/fflog.tmpl $hgtemplatesdir
 	;;
     remove)
 	rm -rf $plugindir/cgi-bin/
+	rm -rf $hgtemplatesdir/fflog.tmpl
 	find $plugindir/www/ -type l -print0 | xargs -r0 rm
 	;;
     *)

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=2aaffcfc303d7ad513eba279314fe5cf6082e988

commit 2aaffcfc303d7ad513eba279314fe5cf6082e988
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun Jan 29 16:33:36 2017 +0100

    scmgit: minor HTML fix

diff --git a/src/plugins/scmgit/common/GitPlugin.class.php b/src/plugins/scmgit/common/GitPlugin.class.php
index 3302114..b7a4c66 100644
--- a/src/plugins/scmgit/common/GitPlugin.class.php
+++ b/src/plugins/scmgit/common/GitPlugin.class.php
@@ -191,7 +191,7 @@ control over it to the project's administrator.");
 				$b .= html_e('p', array(), _('SSH must be installed on your client machine.'));
 				$htmlRepo = '';
 				foreach ($repo_list as $repo_name) {
-						$htmlRepo .= html_e('tt', array(), 'git clone git+ssh://'.$d.'@' . forge_get_config('scm_host') . forge_get_config('repos_path', 'scmgit') .'/'. $project->getUnixName() .'/'. $repo_name .'.git').html_e('br');
+					$htmlRepo .= html_e('tt', array(), 'git clone git+ssh://'.$d.'@' . forge_get_config('scm_host') . forge_get_config('repos_path', 'scmgit') .'/'. $project->getUnixName() .'/'. $repo_name .'.git').html_e('br');
 				}
 				$b .= html_e('p', array(), $htmlRepo);
 				$b .= '</div>';
@@ -200,10 +200,9 @@ control over it to the project's administrator.");
 				$b .= '<div id="tabber-smarthttp" class="tabbertab" >';
 				$b .= html_e('p', array(), _('Enter your site password when prompted.'));
 				$htmlRepo = '';
-
 				$protocol = forge_get_config('use_ssl', 'scmgit') ? 'https' : 'http';
 				foreach ($repo_list as $repo_name) {
-					$htmlRepo .= '<tt>git clone '.$protocol.'://'.$d.'@' . forge_get_config('scm_host').'/authscm/'.$d.'/git/'.$project->getUnixName() .'/'. $repo_name .'.git</tt><br />';
+					$htmlRepo .= html_e('tt', array(), 'git clone '.$protocol.'://'.$d.'@' . forge_get_config('scm_host').'/authscm/'.$d.'/git/'.$project->getUnixName() .'/'. $repo_name .'.git').html_e('br');
 				}
 				$b .= html_e('p', array(), $htmlRepo);
 				$b .= '</div>';
@@ -234,7 +233,7 @@ control over it to the project's administrator.");
 					' '. _('Enter your site password when prompted.'));
 				$htmlRepo = '';
 				foreach ($repo_list as $repo_name) {
-					$b .= '<tt>git clone '.$protocol.'://<i>'._('developername').'</i>@' . forge_get_config('scm_host').'/authscm/<i>'._('developername').'</i>/git/'.$project->getUnixName() .'/'. $repo_name .'.git</tt><br />';
+					$htmlRepo .= '<tt>git clone '.$protocol.'://<i>'._('developername').'</i>@' . forge_get_config('scm_host').'/authscm/<i>'._('developername').'</i>/git/'.$project->getUnixName() .'/'. $repo_name .'.git</tt><br />';
 				}
 				$b .= html_e('p', array(), $htmlRepo);
 				$b .= '</div>';

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=851f8d50aa0bb8d4fef79502aa069ef520688a65

commit 851f8d50aa0bb8d4fef79502aa069ef520688a65
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun Jan 29 16:30:28 2017 +0100

    scmhg: use general configuration for ssl

diff --git a/src/plugins/scmhg/etc/scmhg.ini b/src/plugins/scmhg/etc/scmhg.ini
index 8acf068..2e175e1 100644
--- a/src/plugins/scmhg/etc/scmhg.ini
+++ b/src/plugins/scmhg/etc/scmhg.ini
@@ -7,7 +7,7 @@
 ; is available in installation_environment = development only.
 plugin_status = valid
 
-use_ssl = no
+use_ssl = "$core/use_ssl"
 use_ssh = yes
 use_dav = yes
 anonhg_login = guest

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=57032afc22892d72660cd5cdfad7aab1d5a3da79

commit 57032afc22892d72660cd5cdfad7aab1d5a3da79
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sat Jan 28 14:43:05 2017 +0100

    scmhg plugin: add missing post install.sh configuration script

diff --git a/src/plugins/scmhg/bin/install.sh b/src/plugins/scmhg/bin/install.sh
new file mode 100644
index 0000000..c68ac8e
--- /dev/null
+++ b/src/plugins/scmhg/bin/install.sh
@@ -0,0 +1,24 @@
+#!/bin/bash -e
+# hgweb post-install
+
+source $(forge_get_config source_path)/post-install.d/common/service.inc
+
+plugindir=$(forge_get_config plugins_path)/scmhg
+hgwebcgi=$(ls /usr/share/doc/mercurial-*/hgweb.cgi 2>/dev/null | tail -1)
+hgwebdir=$(ls -d /usr/share/doc/mercurial-* 2>/dev/null | tail -1)
+
+case "$1" in
+    configure)
+	# hgweb
+	if [ -z "$hgwebcgi" -o -z "$hgwebdir" ]; then echo "Cannot find gitweb"; exit 1; fi
+	mkdir -p -m 755 $plugindir/cgi-bin/
+	ln -nfs $hgwebcgi                 $plugindir/cgi-bin/
+	;;
+    remove)
+	rm -rf $plugindir/cgi-bin/
+	find $plugindir/www/ -type l -print0 | xargs -r0 rm
+	;;
+    *)
+        echo "Usage: $0 {configure|remove}"
+        exit 1
+esac

-----------------------------------------------------------------------

Summary of changes:
 src/plugins/scmgit/common/GitPlugin.class.php      |   7 +-
 src/plugins/scmhg/bin/install.sh                   |  28 ++
 src/plugins/scmhg/common/HgPlugin.class.php        | 548 +++++++++++----------
 .../etc/httpd.conf.d/vhost-scm-plugin-scmhg.inc    |  16 +
 src/plugins/scmhg/etc/scmhg.ini                    |   2 +-
 5 files changed, 341 insertions(+), 260 deletions(-)
 create mode 100644 src/plugins/scmhg/bin/install.sh
 create mode 100644 src/plugins/scmhg/etc/httpd.conf.d/vhost-scm-plugin-scmhg.inc


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list