Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change svn url in svnsync?

Tags:

svn

svnsync

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>'
like image 992
sdu Avatar asked Nov 11 '10 14:11

sdu


People also ask

What is SVN URL?

As illustrated throughout this book, Subversion uses URLs to identify versioned resources in Subversion repositories. For the most part, these URLs use the standard syntax, allowing for server names and port numbers to be specified as part of the URL: $ svn checkout http://svn.example.com:9834/repos …

What is SVN sync?

svnsync is the Subversion remote repository mirroring tool. Put simply, it allows you to replay the revisions of one repository into another one. In any mirroring scenario, there are two repositories: the source repository, and the mirror (or “sink”) repository.


1 Answers

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][~]$.

like image 83
Bob Denny Avatar answered Sep 21 '22 01:09

Bob Denny