Koozali.org: home of the SME Server

Can I change SVN web path ?

Offline mpfj

  • 18
  • +0/-0
Can I change SVN web path ?
« on: December 07, 2017, 03:39:52 PM »
Currently testing a new SVN installation, and I see the repos are all accessed via HTTP as http://<server>/<repo>.

Is there any way to change this so the repos appear as http://<server>/svn/<repo> ?

Or, even better, if each repo could have its own HTTP path ... e.g.

http://<server>/svn/companyA/repo1
http://<server>/svn/companyA/repo2
http://<server>/svn/companyB/repo5
... etc ...

Offline Stefano

  • *
  • 10,839
  • +2/-0
Re: Can I change SVN web path ?
« Reply #1 on: December 07, 2017, 04:18:42 PM »
moving to contribs section

Online ReetP

  • *
  • 3,736
  • +5/-0
Re: Can I change SVN web path ?
« Reply #2 on: December 07, 2017, 04:58:50 PM »
Currently testing a new SVN installation, and I see the repos are all accessed via HTTP as http://<server>/<repo>.

Is there any way to change this so the repos appear as http://<server>/svn/<repo> ?

Or, even better, if each repo could have its own HTTP path ... e.g.

http://<server>/svn/companyA/repo1
http://<server>/svn/companyA/repo2
http://<server>/svn/companyB/repo5
... etc ...

I guess you would probably need a custom http template somewhere.
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline Jean-Philippe Pialasse

  • *
  • 2,763
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: Can I change SVN web path ?
« Reply #3 on: December 07, 2017, 08:22:01 PM »
Code: [Select]
mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHosts/
cp /etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/28SubversionContent /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHosts/

vim /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHosts/28SubversionContent


then change
Code: [Select]
                $OUT .= "    RewriteRule ^/$key(/.*|\$)    https://%{HTTP_HOST}/$key\$1 [L,R]\n\n";to
Code: [Select]
                $OUT .= "    RewriteRule ^/svn/$key(/.*|\$)    https://%{HTTP_HOST}/svn/$key\$1 [L,R]\n\n";

and
Code: [Select]
                    $OUT .= "    <Location /$key>\n\n";to
Code: [Select]
                    $OUT .= "    <Location /svn/$key>\n\n";

and as soon as you found a way to get out of vim  :D, your are done  by just doing :

Code: [Select]
signal-event remoteacces-update
« Last Edit: December 07, 2017, 08:23:36 PM by Jean-Philippe Pialasse »

Online ReetP

  • *
  • 3,736
  • +5/-0
Re: Can I change SVN web path ?
« Reply #4 on: December 07, 2017, 08:26:43 PM »
Ahhh so simple :-)

mc/mcedit to save all that vim nonsense ;-)

...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline Jean-Philippe Pialasse

  • *
  • 2,763
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: Can I change SVN web path ?
« Reply #5 on: December 07, 2017, 08:37:08 PM »
Ahhh so simple :-)

mc/mcedit to save all that vim nonsense ;-)

this not non sense :D this is a trap

thinking of it it could be a NFR : adding a variable there to allow to set a path
Code: [Select]
my $path = $modDAVSVN->prop("path") || '';
$path = $path."/" if ( substr($path, -1) ne "/" &&  $path ne "" );

 $OUT .= "    RewriteRule ^/$path$key(/.*|\$)    https://%{HTTP_HOST}/$path$key\$1 [L,R]\n\n";

                    $OUT .= "    <Location /$path$key>\n\n";



then set your path
Code: [Select]
config setprop modDAVSVN path svn
signal-event remoteacces-update
« Last Edit: December 07, 2017, 08:38:47 PM by Jean-Philippe Pialasse »

Offline mpfj

  • 18
  • +0/-0
Re: Can I change SVN web path ?
« Reply #6 on: December 08, 2017, 05:44:42 PM »
Finally got something working which allowed me to have a path per repo (using a "Path" property)

In 28SubversionContent I added:-

Code: [Select]
my $path = $properties{'Path'} || '';
$path = $path."/" if ( substr($path, -1) ne "/" && $path ne "" );

And changed
Code: [Select]
$OUT .= " RewriteRule ^/$key(/.*|\$) https://%{HTTP_HOST}/$key\$1 [L,R]\n\n";
$OUT .= " <Location /$key>\n\n";

… to …
Code: [Select]
$OUT .= " RewriteRule ^/$path$key(/.*|\$) https://%{HTTP_HOST}/$path$key\$1 [L,R]\n\n";
$OUT .= " <Location /$path$key>\n\n";

Thanks for the assistance  :-P

Offline Jean-Philippe Pialasse

  • *
  • 2,763
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: Can I change SVN web path ?
« Reply #7 on: December 08, 2017, 07:55:37 PM »
that is also an interesting approach, we could mix both.

allow to set one for all, and overide the value per repo.