Project

General

Profile

Unable to view code or diffs when a repository subdirectory is specified for the URL instead of the root - any way to get this to work?

Added by Andy P over 14 years ago

Greetings,

I have a subversion repository that consists of several projects with a layout similar to the following:

  • Root
    • Project_1
    • Project_2
    • Project_3

The make-believe url for Root is https://repository.server/svn.

I have created three projects in Redmine, one for each of the Project_? bits in the repository.

At first glance this appears to work wonderfully. The Repository view of the projects in Redmine displays just those entities and revisions that are associated with the specific projects. Cool!

The problem we are encountering is when we try to view the commited version of an entity or view diffs via Redmine. We receive the following error:

The entry or revision was not found in the repository.

It appears as though the repository URL that Redmine is constructing is mangled by not specifying the root URL in the repository setting of the Redmine project.

If we set the Repository URL setting to the root url of the repository then everything works great except that all files for all projects are now visible in Redmine which is not the behaviour we want.

Is there an easy way, for somebody first introduced to Ruby, to resolve this issue?

Thank you,
Andy


Replies (3)

RE: Unable to view code or diffs when a repository subdirectory is specified for the URL instead of the root - any way to get this to work? - Added by Felix Schäfer over 14 years ago

AFAIK, redmine expects to be given the whole of a subversion repository, not just a part of it, and making this work would mean refactoring a lot of the subversion accessing part of redmine. I think it would be much simpler to just split up your subversion repository into three separate repositories (that's quite easy, you should be able to find tutorials through google) and serve these three repositories through SVNParentPath (or whatever the exact name is) option of mod_svn.

RE: Unable to view code or diffs when a repository subdirectory is specified for the URL instead of the root - any way to get this to work? - Added by Jean-Philippe Lang over 14 years ago

Actually, it may not be platform specific.
Can you try this patch?

Index: app/models/repository/subversion.rb
===================================================================
--- app/models/repository/subversion.rb    (revision 3134)
+++ app/models/repository/subversion.rb    (working copy)
@@ -84,6 +84,6 @@
   #     url      = file:///var/svn/foo/bar
   #     => returns /bar
   def relative_url
-    @relative_url ||= url.gsub(Regexp.new("^#{Regexp.escape(root_url)}"), '')
+    @relative_url ||= url.gsub(Regexp.new("^#{Regexp.escape(root_url)}", Regexp::IGNORECASE), '')
   end
 end
    (1-3/3)