allura-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Brondsema <d...@brondsema.net>
Subject Re: Subversion server setting on apache & mod_dav_svn
Date Mon, 22 Apr 2013 15:28:56 GMT
Here's the latest version of the patch
https://sourceforge.net/p/allura/pastebin/517557273e5e837ec65122c1/


diff -rup subversion-1.7.7.orig/subversion/libsvn_repos/repos.c
subversion-1.7.7/subversion/libsvn_repos/repos.c
--- subversion-1.7.7.orig/subversion/libsvn_repos/repos.c	2012-11-15
16:04:07.000000000 +0000
+++ subversion-1.7.7/subversion/libsvn_repos/repos.c	2012-12-07
23:06:10.352959642 +0000
@@ -1286,7 +1286,7 @@ svn_repos_create(svn_repos_t **repos_p,
  * on errors (which would be permission errors, probably) so that
  * we the user will see them after we try to open the repository
  * for real.  */
-static svn_boolean_t
+svn_boolean_t
 check_repos_path(const char *path,
                  apr_pool_t *pool)
 {
diff -rup subversion-1.7.7.orig/subversion/mod_dav_svn/repos.c
subversion-1.7.7/subversion/mod_dav_svn/repos.c
--- subversion-1.7.7.orig/subversion/mod_dav_svn/repos.c	2012-11-15
16:04:07.000000000 +0000
+++ subversion-1.7.7/subversion/mod_dav_svn/repos.c	2012-12-07
23:06:18.291130038 +0000
@@ -1288,10 +1288,13 @@ dav_svn_split_uri(request_rec *r,

   else
     {
-      /* SVNParentPath was used instead: assume the first component of
+      /* SVNParentPath was used instead: figure out which component of
          'relative' is the name of a repository. */
-      const char *magic_component, *magic_end;
+      extern svn_boolean_t check_repos_path(const char *path, apr_pool_t *pool);
+      const char *magic_component = NULL, *magic_end;
+      char *repos_path;

+     do {
       /* A repository name is required here.
          Remember that 'relative' always starts with a "/". */
       if (relative[1] == '\0')
@@ -1309,16 +1312,34 @@ dav_svn_split_uri(request_rec *r,
           /* ### Request was for parent directory with no trailing
              slash; we probably ought to just redirect to same with
              trailing slash appended. */
+         if (!magic_component)
           magic_component = relative + 1;
+         else {
+          magic_component = apr_pstrcat(r->pool, magic_component,
+                                        relative, NULL);
+         }
           relative = "/";
         }
       else
         {
+         if (!magic_component)
           magic_component = apr_pstrndup(r->pool, relative + 1,
                                          magic_end - relative - 1);
+         else {
+          char *tmp_magic_component;
+
+          tmp_magic_component = apr_pstrndup(r->pool, relative,
+                                             magic_end - relative);
+          magic_component = apr_pstrcat(r->pool, magic_component,
+                                        tmp_magic_component, NULL);
+         }
           relative = magic_end;
         }

+      repos_path = svn_path_join(fs_parent_path, magic_component,
+                                 r->pool);
+     } while (check_repos_path(repos_path, r->pool) != TRUE);
+
       /* return answer */
       *repos_basename = magic_component;
     }
@@ -1472,6 +1493,7 @@ cleanup_fs_access(void *data)
 }


+#if 0
 /* Helper func to construct a special 'parentpath' private resource. */
 static dav_error *
 get_parentpath_resource(request_rec *r,
@@ -1527,6 +1549,7 @@ get_parentpath_resource(request_rec *r,
   *resource = &comb->res;
   return NULL;
 }
+#endif

 /* --------------- Borrowed from httpd's mod_negotiation.c -------------- */

@@ -1955,6 +1978,7 @@ get_resource(request_rec *r,
   xslt_uri = dav_svn__get_xslt_uri(r);
   fs_parent_path = dav_svn__get_fs_parent_path(r);

+#if 0
   /* Special case: detect and build the SVNParentPath as a unique type
      of private resource, iff the SVNListParentPath directive is 'on'. */
   if (fs_parent_path && dav_svn__get_list_parentpath_flag(r))
@@ -1978,6 +2002,7 @@ get_resource(request_rec *r,
           return NULL;
         }
     }
+#endif

   /* This does all the work of interpreting/splitting the request uri. */
   err = dav_svn_split_uri(r, r->uri, root_path,
@@ -3264,8 +3289,13 @@ deliver(const dav_resource *resource, ap
         {
           apr_hash_index_t *hi;
           apr_hash_t *dirents;
+          int root_path_len = strlen(resource->info->repos->root_path);
           const char *fs_parent_path =
-            dav_svn__get_fs_parent_path(resource->info->r);
+            apr_pstrcat(resource->info->r->pool,
+                        dav_svn__get_fs_parent_path(resource->info->r),
+                        resource->info->r->uri
+                        + ((root_path_len > 1) ? root_path_len : 0),
+                        NULL);

           serr = svn_io_get_dirents3(&dirents, fs_parent_path, TRUE,
                                      resource->pool, resource->pool);







On 4/17/13 4:41 PM, Dave Brondsema wrote:
> On SourceForge our SVN servers run with a patch to SVNParentPath to support
> recursion.  http://subversion.tigris.org/issues/show_bug.cgi?id=3588 has some
> patches for it, but they are old.  I'm seeing if I can get the latest version of
> our patch public that works with a recent release of Subversion.
> 
> On 4/17/13 5:02 AM, 王再國 wrote:
>> I think so. "inotifywait, or a simple cron job would probably be easier."
>>
>> project has subproject. recursively sub project.
>> allura neighborhood can invite project to other neighborhood.
>> This will change all relation path.
>> I don't know sourceforge how to setting svn server.
>> but I know have many event handler or script.
>>
>> now, I use apache macro module.
>>
>> <Macro SVNSetup $nh_project>
>>  <location $nh_project>
>>    DAV svn
>>    SVNParentPath /scm/svn$nh_project
>>      ...
>>  </location>
>> </Macro>
>>
>> NameVirtualHost 192.168.22.121
>> <VirtualHost svn.allura.org <http://svn.allura.org>>
>>  Use SVNSetup /p/allura
>>  Use SVNSetup /p/test
>>  Use SVNSetup /p/test/sub1
>> </VirtualHost>
>>
>> and I need to sync the conf with allura neighborhood; project; subproject.
>> sourceforge how to setting svn server???
>>
>> wangaguo
>>
>>
>> 2013/4/17 王再國 <wangaguo@gmail.com <mailto:wangaguo@gmail.com>>
>>
>>     if project & repos below.
>>     /p/allura/svn
>>     /p/testproject01/svn
>>     /p/testproject02/svn
>>
>>     and /tmp/svn/ is SVNParentPath
>>
>>     maybe symlink below.
>>     /tmp/svn/allura-svn
>>     /tmp/svn/testproject01-svn
>>     /tmp/svn/testproject02-svn
>>
>>     but the web url is not below.
>>     http://svn.allura.org/p/allura/svn
>>     http://svn.allura.org/p/testproject01/svn
>>
>>     web url is below.
>>     http://svn.allura.org/allura-svn
>>     http://svn.allura.org/testproject01-svn
>>
>>     wangaguo
>>
>>
>>
>>     2013/4/16 Tim Van Steenburgh <tvansteenburgh@gmail.com
>>     <mailto:tvansteenburgh@gmail.com>>
>>
>>         One idea would be to use bash + inotifywait to watch /tmp/svn, and
>>         rename + symlink new repo directories to another location, and use that
>>         location as the SVNParentPath. I'm not totally sure it would work, but
>>         maybe worth a try?
>>
>>         Tim
>>
>>         On Tuesday, April 16, 2013 at 2:58 AM, 王再國 wrote:
>>
>>>         If all repos in the /tmp/svn then set SVNParentPath on /tmp/svn is ok.
>>>         But allura has three level neighborhood; project; repos.
>>>         SVNParentPath only support one level parent path. no recursive.
>>>         e.g. /p/allura/svn1, In apache conf, I only can seting to the allura
>>>         project.
>>>
>>>         wangaguo
>>>
>>>
>>>         2013/4/16 王再國 <wangaguo@gmail.com <mailto:wangaguo@gmail.com>>
>>>
>>>             Hi.
>>>             svn can set SVNParentPath for multiple repository.
>>>             But allura scm direcotry stucture is neighborhood/project/repos.
>>>             How to setting up svn apache & mod_dav_svn for allura svn folder.
>>>
>>>             wangaguo
>>>
>>>
>>>
>>
>>
>>
> 
> 
> 



-- 
Dave Brondsema : dave@brondsema.net
http://www.brondsema.net : personal
http://www.splike.com : programming
              <><

Mime
View raw message