[Fusionforge-commits] r11905 - branches/Branch_5_1/src/plugins/scmsvn/common
Roland Mas
lolando at libremir.placard.fr.eu.org
Tue Dec 28 11:22:47 CET 2010
Author: lolando
Date: 2010-12-28 11:22:46 +0100 (Tue, 28 Dec 2010)
New Revision: 11905
Modified:
branches/Branch_5_1/src/plugins/scmsvn/common/SVNPlugin.class.php
Log:
Test for presence of /trunk before suggesting what to svn checkout (patch [#240] by Sylvain Le Gall)
Modified: branches/Branch_5_1/src/plugins/scmsvn/common/SVNPlugin.class.php
===================================================================
--- branches/Branch_5_1/src/plugins/scmsvn/common/SVNPlugin.class.php 2010-12-28 10:19:00 UTC (rev 11904)
+++ branches/Branch_5_1/src/plugins/scmsvn/common/SVNPlugin.class.php 2010-12-28 10:22:46 UTC (rev 11905)
@@ -79,6 +79,19 @@
return '<p>' . _('Documentation for Subversion (sometimes referred to as "SVN") is available <a href="http://svnbook.red-bean.com/">here</a>.') . '</p>';
}
+ function topModule ($project) {
+ // Check toplevel module presence
+ $repo = 'file://' . forge_get_config('repos_path', $this->name).'/'.$project->getUnixName().'/';
+ $res = array ();
+ $module = 'trunk';
+ if (!(exec("svn ls '$repo'", $res) && in_array($module.'/', $res)))
+ {
+ $module = '';
+ }
+
+ return '/'.$module;
+ }
+
function getInstructionsForAnon ($project) {
$b = '<h2>' . _('Anonymous Subversion Access') . '</h2>';
$b .= '<p>';
@@ -86,11 +99,12 @@
$b .= '</p>';
$b .= '<p>' ;
+ $module = $this->topModule($project);
if (forge_get_config('use_ssh', 'scmsvn')) {
- $b .= '<tt>svn checkout svn://'.$project->getSCMBox().$this->svn_root.'/'.$project->getUnixName().'/trunk</tt><br />';
+ $b .= '<tt>svn checkout svn://'.$project->getSCMBox().$this->svn_root.'/'.$project->getUnixName().$module.'</tt><br />';
}
if (forge_get_config('use_dav', 'scmsvn')) {
- $b .= '<tt>svn checkout --username '.forge_get_config('anonsvn_login', 'scmsvn').' http'.((forge_get_config('use_ssl', 'scmsvn')) ? 's' : '').'://' . $project->getSCMBox(). $this->svn_root .'/'. $project->getUnixName() .'/trunk</tt><br/><br/>';
+ $b .= '<tt>svn checkout --username '.forge_get_config('anonsvn_login', 'scmsvn').' http'.((forge_get_config('use_ssl', 'scmsvn')) ? 's' : '').'://' . $project->getSCMBox(). $this->svn_root .'/'. $project->getUnixName() .$module.'</tt><br/><br/>';
$b .= _('The password is ').forge_get_config('anonsvn_password', 'scmsvn').'<br/>';
}
$b .= '</p>';
@@ -99,6 +113,9 @@
function getInstructionsForRW ($project) {
$b = '' ;
+
+ $module = $this->topModule($project);
+
if (session_loggedin()) {
$u =& user_get_object(user_getid()) ;
$d = $u->getUnixName() ;
@@ -109,7 +126,7 @@
$b .= '<p>';
$b .= _('Only project developers can access the SVN tree via this method. SSH must be installed on your client machine. Enter your site password when prompted.');
$b .= '</p>';
- $b .= '<p><tt>svn checkout svn+ssh://'.$d.'@' . $project->getSCMBox() . $this->svn_root .'/'. $project->getUnixName().'/trunk</tt></p>' ;
+ $b .= '<p><tt>svn checkout svn+ssh://'.$d.'@' . $project->getSCMBox() . $this->svn_root .'/'. $project->getUnixName().$module.'</tt></p>' ;
}
if (forge_get_config('use_dav', 'scmsvn')) {
$b .= '<h2>';
@@ -118,7 +135,7 @@
$b .= '<p>';
$b .= _('Only project developers can access the SVN tree via this method. Enter your site password when prompted.');
$b .= '</p>';
- $b .= '<p><tt>svn checkout --username '.$d.' http'.((forge_get_config('use_ssl', 'scmsvn')) ? 's' : '').'://'. $project->getSCMBox() . $this->svn_root .'/'.$project->getUnixName().'/trunk</tt></p>' ;
+ $b .= '<p><tt>svn checkout --username '.$d.' http'.((forge_get_config('use_ssl', 'scmsvn')) ? 's' : '').'://'. $project->getSCMBox() . $this->svn_root .'/'.$project->getUnixName().$module.'</tt></p>' ;
}
} else {
if (forge_get_config('use_ssh', 'scmsvn')) {
@@ -128,7 +145,7 @@
$b .= '<p>';
$b .= _('Only project developers can access the SVN 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.');
$b .= '</p>';
- $b .= '<p><tt>svn checkout svn+ssh://<i>'._('developername').'</i>@' . $project->getSCMBox() . $this->svn_root .'/'. $project->getUnixName().'/trunk</tt></p>' ;
+ $b .= '<p><tt>svn checkout svn+ssh://<i>'._('developername').'</i>@' . $project->getSCMBox() . $this->svn_root .'/'. $project->getUnixName().$module.'</tt></p>' ;
}
if (forge_get_config('use_dav', 'scmsvn')) {
$b .= '<h2>';
@@ -137,7 +154,7 @@
$b .= '<p>';
$b .= _('Only project developers can access the SVN tree via this method. Substitute <i>developername</i> with the proper values. Enter your site password when prompted.');
$b .= '</p>';
- $b .= '<p><tt>svn checkout --username <i>'._('developername').'</i> http'.((forge_get_config('use_ssl', 'scmsvn')) ? 's' : '').'://'. $project->getSCMBox() . $this->svn_root .'/'.$project->getUnixName().'/trunk</tt></p>' ;
+ $b .= '<p><tt>svn checkout --username <i>'._('developername').'</i> http'.((forge_get_config('use_ssl', 'scmsvn')) ? 's' : '').'://'. $project->getSCMBox() . $this->svn_root .'/'.$project->getUnixName().$module.'</tt></p>' ;
}
}
return $b ;
More information about the Fusionforge-commits
mailing list