Skip to content

svnsync switch – How to change or relocate source url for svnsync mirror?

You have a working svnsync mirror and you want to change or update the url of the source repository. If this is what you are looking for, read on.

“svn switch” is used to change(relocate) the URL of a source repository. However, there is no “svnsync switch” to update the url of the source repository for a mirrored repository. You need to update the properties of the version 0 (zero) of the mirror repository and it will start syncing from the new URL.

Start with looking at the current value of the svnsync URL

svn propget svn:sync-from-url –revprop -r 0 MIRROR_URL
If your mirror repository is local, this would be something like file:///home/repository

Then run the following to update the source URL

svn propset svn:sync-from-url –revprop -r 0 NEW_SOURCE_URL MIRROR_URL

That’s it. Now you can run svnsync to sync from the new URL

svnsync –non-interactive sync MIRROR_URL

Note: You can technically do the same URL update with “svnadmin setrevprop” or “svn propedit”. However, for both of these commands, you will have to put the URL in a text file and have the command read it from there. The problem is, most text editors will add an end of line character which may cause the following error messages:

svnsync: Illegal repository URL or svnsync: Malformed URL for repository

Using the propset command will eliminate the need for reading the URL from a file and therefore avoid this error.

Categories: Linux tips.

Comment Feed

3 Responses

  1. -revprop should have been –revprop in all the commands that have it, otherwise a great tip.

  2. My two cents. You must also change the sync-from-uuid property according to the new source.

  3. What Jakob means is that two dashes merge to one in WordPress, unless you mark it up as code.

Some HTML is OK

or, reply to this post via trackback.