Earlier today, I found myself working with an SVN checkout. As it happened, the repository that the files had been checked out from was no longer responding and upon enquiry, I found out that it had been moved to a different URL. Now, while I could have just as easily created an entirely different checkout of the files using the new URL, considering the local customisations, I looked to see if I could just do something like a live switch. As I found out after some mucking about, switch is certainly the operative word.
If you have local customisations, backup your checkout before attempting anything. Or create a patch.
Switching the URL of an SVN repository that has already been checked out locally can be done with the following command:
svn switch --relocate OLD_URL NEW_URL
or with an example:
svn switch --relocate https://foo.example.com/myrepo/ https://bar.example.com/myrepo/
This command, when executed checks if the new repository is valid and that you have access to it. Once this is out of the way, it simply rewrites the repository URLs used in the checkout. The operation can take a little while to complete depending on the complexity of the checkout.
- Log in to post comments