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>';
$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>';
function getInstructionsForRW ($project) {
$b = '' ;
+
+ $module = $this->topModule($project);
+
if (session_loggedin()) {
$u =& user_get_object(user_getid()) ;
$d = $u->getUnixName() ;
$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>';
$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')) {
$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>';
$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 ;