19

How can I change (relocate) a subversion url that I entered when creating a mirror repository using "svnsync init" (example from #https://whatever to svn://whatever)?

tried to run svnsync init again with new url but

svnsync init file:///<path_to_mirror> http:///<new_url>
svnsync: Destination repository is already synchronizing from 'http:///<old_url>'
2
  • did you try using svnsync with the new url for subsequent sync's. My gut feel is it should work. Nov 11, 2010 at 15:46
  • did try to call again svnsync init with new url but this doesn't work - svnsync says that the mirror repository is synced with "old" url
    – sdu
    Nov 11, 2010 at 20:59

3 Answers 3

23

The sync-from URL is stored as a revprop in the mirror repo. If on the machine with the mirror repository (my situation), use the svnlook tool to look and svnadmin to change:

[email protected][~]$ svnlook pg --revprop -r0 /path/to/mirror/repo svn:sync-from-url
svn+ssh://svn.abc.com:1234/svn/foo

You will see the URL of the repo to which your mirror is currently syncing. In the above example, the master repo URL ends with .../foo. It may not have a newline at the end, so your shell prompt may follow. Now you need to get that into a file as svnadmin uses a file for input to change revprops.

[email protected][~]$ svnlook pg --revprop -r0 /path/to/mirror/repo svn:sync-from-url > t.txt

Now edit t.txt to change the URL to the master repo. This can cause a newline to appear at the end of t.txt and result in obscure/meaningless error messages from svnsync. So get rid of it:

[email protected][~]$ cat t.txt | tr -d '\n' > t2.txt

Note that we now have t2.txt which is the sanitized file. Then use svnadmin to change the revprop to the contents of the just-edited and sanitized file:

[email protected][~]$ svnadmin setrevprop /path/to/mirror/repo -r0 svn:sync-from-url t2.txt

Note that t2.txt is used not t.txt. Finally, check your changes:

[email protected][~]$ svnlook pg --revprop -r0 /path/to/mirror/repo svn:sync-from-url
svn+ssh://svn.def.com:5678/svn/foo

You should see your new repo URL immediately followed by the shell prompt, with no newline. In the above example the URL ends in foo and is immediately followed by the shell prompt [email protected][~]$.

2
  • I followed this steps and get error when trying svnsync sync /repo/path svnsync: Repository UUID '72fa8357-5795-f84a-b72d-10573eb4d6c2' doesn't match expected UUID 'a3f6904a-36ca-4011-b160-aab731c98da0'
    – qwazer
    May 14, 2011 at 8:36
  • 2
    modify file db\revprops\0\0 and change svn:sync-from-uuid property. now all ok
    – qwazer
    May 14, 2011 at 9:15
14

If you use the account you use to run svnsync with you can simply use:

svn propset --revprop -r 0 svn:sync-from-url http://my.new/url url://to.my.repo

If you followed the instructions in the manual and added a pre-rev-props hook that denies everyone but the svnsync user to change the rev props this should work.

1

Svnsync stores the remote repository URL in the revision properties of the first revision of the repository mirror. Thus, you can view the currently configured repository URL on your local mirror like this:

$ svn pg --revprop -r0 svn:sync-from-url file:///path/to/svn-mirror

That means for changing the remote repository URL you just have to change the revision property. For example:

$ svn ps --revprop -r0 svn:sync-from-url https://svn.example.org/repo \
         file:///path/to/svn-mirror/

Example output:

property 'svn:sync-from-url' set on repository revision 0

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.