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, feature/subversion-multiple-repositories-per-project has been 
updated
       via  2a3699b2b9a8d322ed286909717956849b839156 (commit)
      from  3fbf8eecd660b6f069f278cf2f5651ddb6001dff (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=2a3699b2b9a8d322ed286909717956849b839156

commit 2a3699b2b9a8d322ed286909717956849b839156
Author: Franck Villaume <[email protected]>
Date:   Tue Feb 27 13:06:58 2018 +0000

    reorganize SCM SVN structures to support online browsing

diff --git a/src/db/20160324-svn-prepare-multirepo.php 
b/src/db/20160324-svn-prepare-multirepo.php
deleted file mode 100644
index e5b057f..0000000
--- a/src/db/20160324-svn-prepare-multirepo.php
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-/**
- * Move SVN repos to the new structure to support multi SVN repositories
- * Copyright, 2016, Franck Villaume - TrivialDev
- * http://fusionforge.org/
- *
- * This file is part of FusionForge.
- *
- * FusionForge is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * FusionForge is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-require_once dirname(__FILE__).'/../common/include/env.inc.php';
-require_once $gfcommon.'include/pre.php';
-
-$svn_root = forge_get_config('repos_path', 'scmsvn');
-if (is_dir($svn_root)) {
-       if ($svn_opendir = opendir($svn_root)) {
-               while (($svn_repodir = readdir($svn_opendir)) !== false) {
-                       $keep = true;
-                       //check if this is a real repo with a project. reponame 
= unix_group_name
-                       $group = group_get_object_by_name($svn_repodir);
-                       if (!$group || !is_object($group) || $group->isError()) 
{
-                               $keep = false;
-                       }
-                       if ($keep) {
-                               if (mkdir($svn_root.'/'.$svn_repodir.'.svn')) {
-                                       if (!rename($svn_root.'/'.$svn_repodir, 
$svn_root.'/'.$svn_repodir.'.svn/'.$svn_repodir)) {
-                                               echo "UNABLE TO MOVE TO FINAL 
DESTINATION REPO: ".$svn_repodir."\n";
-                                       } else {
-                                               
rename($svn_root.'/'.$svn_repodir.'.svn', $svn_root.'/'.$svn_repodir);
-                                       }
-                               } else {
-                                       echo "UNABLE TO CREATE TARGET DIR FOR 
REPO: ".$svn_repodir."\n";
-                               }
-                       }
-               }
-       }
-}
-echo "SUCCESS\n";
diff --git a/src/plugins/scmsvn/common/SVNPlugin.class.php 
b/src/plugins/scmsvn/common/SVNPlugin.class.php
index 4e80d8b..d31540b 100644
--- a/src/plugins/scmsvn/common/SVNPlugin.class.php
+++ b/src/plugins/scmsvn/common/SVNPlugin.class.php
@@ -104,7 +104,7 @@ some control over it to the project's administrator.");
 
        function topModule($project, $repo_name) {
                // Check toplevel module presence
-               $repo = 'file://' . forge_get_config('repos_path', 
$this->name).'/'.$project->getUnixName().'.svn/'.$repo_name.'/';
+               $repo = 'file://' . forge_get_config('repos_path', 
$this->name).'/'.$repo_name.'/';
                $res = array ();
                $module = 'trunk';
                if (!is_file($repo.'/format')) {
@@ -142,7 +142,7 @@ some control over it to the project's administrator.");
                        $b .= html_e('h3', array(), _('via SVN'));
                        foreach ($repo_list as $repo_name) {
                                $module = $this->topModule($project, 
$repo_name);
-                               $b .= html_e('tt', array(), 'svn '.$ssh_port.' 
checkout 
svn://'.$this->getBoxForProject($project).$this->svn_root_fs.'/'.$project->getUnixName().'/'.$repo_name.$module).html_e('br');
+                               $b .= html_e('tt', array(), 'svn '.$ssh_port.' 
checkout 
svn://'.$this->getBoxForProject($project).$this->svn_root_fs.'/'.$repo_name.$module).html_e('br');
                        }
                }
 
@@ -150,7 +150,7 @@ some control over it to the project's administrator.");
                        $b .= html_e('h3', array(), _('via DAV'));
                        foreach ($repo_list as $repo_name) {
                                $module = $this->topModule($project, 
$repo_name);
-                               $b .= html_e('tt', array(), 'svn checkout 
http'.((forge_get_config('use_ssl', 'scmsvn')) ? 's' : '').'://'. 
$this->getBoxForProject($project). 
'/anonscm/svn/'.$project->getUnixName().'/'.$repo_name.$module).html_e('br');
+                               $b .= html_e('tt', array(), 'svn checkout 
http'.((forge_get_config('use_ssl', 'scmsvn')) ? 's' : '').'://'. 
$this->getBoxForProject($project). 
'/anonscm/svn/'.$repo_name.$module).html_e('br');
                        }
                }
                return $b;
@@ -196,9 +196,9 @@ some control over it to the project's administrator.");
                                foreach ($repo_list as $repo_name) {
                                        $module = $this->topModule($project, 
$repo_name);
                                        if 
(forge_get_config('use_shell_limited')) {
-                                               $b .= html_e('tt', array(), 
'svn '.$ssh_port.'checkout 
svn+ssh://'.$d.'@'.$this->getBoxForProject($project).'/'.$project->getUnixName().'/'.$repo_name.$module).html_e('br');
+                                               $b .= html_e('tt', array(), 
'svn '.$ssh_port.'checkout 
svn+ssh://'.$d.'@'.$this->getBoxForProject($project).'/'.$repo_name.$module).html_e('br');
                                        } else {
-                                               $b .= html_e('tt', array(), 
'svn '.$ssh_port.'checkout 
svn+ssh://'.$d.'@'.$this->getBoxForProject($project).$this->svn_root_fs .'/'. 
$project->getUnixName().'/'.$repo_name.$module).html_e('br');
+                                               $b .= html_e('tt', array(), 
'svn '.$ssh_port.'checkout 
svn+ssh://'.$d.'@'.$this->getBoxForProject($project).$this->svn_root_fs.'/'.$repo_name.$module).html_e('br');
                                        }
                                }
                                $b .= '</div>';
@@ -210,7 +210,7 @@ some control over it to the project's administrator.");
                                $b .= '</p>';
                                foreach ($repo_list as $repo_name) {
                                        $module = $this->topModule($project, 
$repo_name);
-                                       $b .= html_e('tt', array(), 'svn 
checkout --username '.$d.' http'.((forge_get_config('use_ssl', 'scmsvn')) ? 's' 
: 
'').'://'.$this->getBoxForProject($project).'/authscm/'.$d.'/svn/'.$project->getUnixName().'/'.$repo_name.$module).html_e('br');
+                                       $b .= html_e('tt', array(), 'svn 
checkout --username '.$d.' http'.((forge_get_config('use_ssl', 'scmsvn')) ? 's' 
: 
'').'://'.$this->getBoxForProject($project).'/authscm/'.$d.'/svn/'.$repo_name.$module).html_e('br');
                                }
                                $b .= '</div>';
                        }
@@ -231,9 +231,9 @@ some control over it to the project's administrator.");
                                foreach ($repo_list as $repo_name) {
                                        $module = $this->topModule($project, 
$repo_name);
                                        if 
(forge_get_config('use_shell_limited')) {
-                                               $b .= html_e('tt', array(), 
'svn '.$ssh_port.'checkout 
svn+ssh://<i>'._('developername').'</i>@'.$this->getBoxForProject($project).'/'.$project->getUnixName().'/'.$repo_name.$module).html_e('br');
+                                               $b .= html_e('tt', array(), 
'svn '.$ssh_port.'checkout 
svn+ssh://<i>'._('developername').'</i>@'.$this->getBoxForProject($project).'/'.$repo_name.$module).html_e('br');
                                        } else {
-                                               $b .= html_e('tt', array(), 
'svn '.$ssh_port.'checkout 
svn+ssh://<i>'._('developername').'</i>@'.$this->getBoxForProject($project).$this->svn_root_fs
 .'/'.$project->getUnixName().'/'.$repo_name.$module).html_e('br');
+                                               $b .= html_e('tt', array(), 
'svn '.$ssh_port.'checkout 
svn+ssh://<i>'._('developername').'</i>@'.$this->getBoxForProject($project).$this->svn_root_fs
 .'/'.$repo_name.$module).html_e('br');
                                        }
                                }
                                $b .= '</div>';
@@ -247,7 +247,7 @@ some control over it to the project's administrator.");
                                $b .= '</p>';
                                foreach ($repo_list as $repo_name) {
                                        $module = $this->topModule($project, 
$repo_name);
-                                       $b .= html_e('tt', array(), 'svn 
checkout --username <i>'._('developername').'</i> 
http'.((forge_get_config('use_ssl', 'scmsvn')) ? 's' : 
'').'://'.$this->getBoxForProject($project).'/authscm/<i>'._('developername').'</i>/svn/'.$project->getUnixName().'/'.$repo_name.$module).html_e('br');
+                                       $b .= html_e('tt', array(), 'svn 
checkout --username <i>'._('developername').'</i> 
http'.((forge_get_config('use_ssl', 'scmsvn')) ? 's' : 
'').'://'.$this->getBoxForProject($project).'/authscm/<i>'._('developername').'</i>/svn/'.$repo_name.$module).html_e('br');
                                }
                                $b .= '</div>';
                        }
@@ -330,7 +330,11 @@ some control over it to the project's administrator.");
                if (!$project) {
                        return;
                }
-               $iframe_src = '/scm/viewvc.php?root='.$project->getUnixName();
+               if (isset($params['extra']) && !empty($params['extra']) && 
$params['extra'] != 'none') {
+                       $iframe_src = '/scm/viewvc.php?root='.$params['extra'];
+               } else {
+                       $iframe_src = 
'/scm/viewvc.php?root='.$project->getUnixName();
+               }
                if ($params['commit']) {
                        $iframe_src .= '&view=rev&revision='.$params['commit'];
                }
@@ -342,7 +346,7 @@ some control over it to the project's administrator.");
                if (!$project) return false;
                if (!$project->isActive()) return false;
 
-               $repo_prefix = forge_get_config('repos_path', 
'scmsvn').'/'.$project->getUnixName().'/';
+               $repo_prefix = forge_get_config('repos_path', 'scmsvn');
                if (!is_dir($repo_prefix) && !mkdir($repo_prefix, 0755, true)) {
                        return false;
                }
@@ -899,10 +903,8 @@ some control over it to the project's administrator.");
                        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()));
+               $result = db_query_params('SELECT count(*) AS count FROM 
scm_secondary_repos WHERE repo_name = $1 AND plugin_id=$2',
+                                         array($params['repo_name'], 
$this->getID()));
                if (!$result) {
                        $params['error_msg'] = db_error();
                        return false;
@@ -1143,6 +1145,12 @@ some control over it to the project's administrator.");
                }
                return $repoarr;
        }
+
+       function getGroupIdFromSecondReponame($repo_name) {
+               $result = db_query_params('SELECT scm_secondary_repos.group_id 
FROM scm_secondary_repos, groups WHERE scm_secondary_repos.group_id = 
groups.group_id AND repo_name = $1 AND plugin_id = $2 AND next_action = $3', 
array($repo_name, $this->getID(), SCM_EXTRA_REPO_ACTION_UPDATE));
+               $arr = db_fetch_array($result);
+               return $arr['group_id'];
+       }
 }
 
 // End of class, helper functions now
diff --git a/src/plugins/scmsvn/libexec/viewvc.cgi 
b/src/plugins/scmsvn/libexec/viewvc.cgi
index e48b0d9..8750160 100755
--- a/src/plugins/scmsvn/libexec/viewvc.cgi
+++ b/src/plugins/scmsvn/libexec/viewvc.cgi
@@ -53,14 +53,12 @@ for pat in CONF_GLOBS:
 #print os.environ
 #sys.exit(0)
 
-
 import sapi
 import viewvc
 
 server = sapi.CgiServer()
 cfg = viewvc.load_config(CONF_PATHNAME, server)
 
-
 import subprocess
 
 # Get repo path from FusionForge config
@@ -68,18 +66,7 @@ import subprocess
 encoding = os.environ.get('HTTP_ACCEPT_ENCODING', None)
 if 'HTTP_ACCEPT_ENCODING' in os.environ: del os.environ['HTTP_ACCEPT_ENCODING']
 repos_path = subprocess.check_output(['forge_get_config', 'repos_path', 
'scmsvn']).rstrip()
-uri = os.environ['REQUEST_URI']
-if uri.find('root=') != -1:
-  # uri is: /some/thing/?root=svnrepo&something&else
-  subrepos_path1 = re.sub('^.*?root=', '', uri)
-  subrepos_path = re.sub('&.*$', '', subrepos_path1)
-else:
-  # uri is: /some/thing/svnrepo/?
-  #  or is: /some/thing/svnrepo?
-  subrepos_path1 = uri.split('/')[3]
-  subrepos_path = re.sub('\?.*$', '', subrepos_path1)
-
-cfg.general.root_parents = [repos_path+'/'+subrepos_path+'.svn: svn']
+cfg.general.root_parents = [repos_path+': svn']
 
 # Authentify request
 try:
diff --git a/src/www/scm/viewvc.php b/src/www/scm/viewvc.php
index 1d7590d..21f2d1d 100644
--- a/src/www/scm/viewvc.php
+++ b/src/www/scm/viewvc.php
@@ -63,6 +63,12 @@ if (!$projectName) {
 // Check permissions
 $Group = group_get_object_by_name($projectName);
 if (!$Group || !is_object($Group)) {
+       $svnplugin = plugin_get_object('scmsvn');
+       $group_id = $svnplugin->getGroupIdFromSecondReponame($projectName);
+       //this may be a SVN second repo. Let's check for it.
+       $Group = group_get_object($group_id);
+}
+if (!$Group || !is_object($Group)) {
        exit_no_group();
 } elseif ( $Group->isError()) {
        exit_error($Group->getErrorMessage(),'summary');

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

Summary of changes:
 src/db/20160324-svn-prepare-multirepo.php     | 51 ---------------------------
 src/plugins/scmsvn/common/SVNPlugin.class.php | 38 ++++++++++++--------
 src/plugins/scmsvn/libexec/viewvc.cgi         | 15 +-------
 src/www/scm/viewvc.php                        |  6 ++++
 4 files changed, 30 insertions(+), 80 deletions(-)
 delete mode 100644 src/db/20160324-svn-prepare-multirepo.php


hooks/post-receive
-- 
FusionForge

_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits

Reply via email to