Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I redirect svn urls to another domain?

background: DynDNS has now started to require a once a month logon to keep their free accounts active (previously you only had to renew your IP address once a month). I am sure sooner or later I will forget to do that and lose my account.

I use mysvn.dyndns.org for accessing my subversion repository on a server which can (as of now) also be reached by svn.mydomain.com. Unfortunately most projects also refer to externals which are also located at mysvn.dyndns.org and I don't really want to go through all projects (>100) and change the externals, because that would probably take several hours and is rather error prone.

Is there any way to configure Windows or the subversion / TortoiseSVN clients to redirect one domain to another?

e.g.:

https://mysvn.dyndns.org/svn/blablub

should be redirected to

https://svn.mydomain.com/svn/blablub

I know that I can add an entry to hosts to redirect to an IP address, but I would prefer redirection to a domain name.

like image 668
dummzeuch Avatar asked May 21 '13 07:05

dummzeuch


2 Answers

You (really) asked 2 related questions:

  • Can I redirect somename.domain.com to anothername.somedomain.com?
  • Can SVN-clients use old name, but intecat with new host?

And short answers will be

  • Yes
  • No

Longer versions

For redirecting old hostname to new you have and can use at least two variations (with the same final result)

  • At the DNS level and CNAME record, which will alias new name to new:

somename.domain.com. IN CNAME anothername.somedomain.com

on request of somename will answer with data from anothername

  • In the Apache's config for host of location somename you can add redirect to anothername Apache's

But: it will work only on browsers's level - when you'll try to use this redirected location as target for any Subversion's command, you'll get error "Repository moved, please relocate" and you must relocate all old resources to new URL.

Good news for your

All externals definition are written as svn-properties inside source repo, you can get list of these externals (with values) and update with the new values, and this operation (theoretically) can be automated

svn propget -R svn:externals . > FILE in the root of working copy for getting externals

svn propset svn:externals --target FILE for defining new externals in batch

like image 147
Lazy Badger Avatar answered Oct 18 '22 01:10

Lazy Badger


Can I suggest an alternate approach?

Assuming you're using svn 1.5 or higher which supports relative URLs for externals, following one of the approaches in this question to change all externals to relative would solve the more fundamental problem.

And if they are not all relative URLs, you can change them from server1 to server2 using a similar script. This is done routinely during server migrations. Assuming you keep good backups, it's probably the approach that will let you get all the pain resolved at one time rather than deferring it over time.

like image 39
explunit Avatar answered Oct 18 '22 01:10

explunit