Subversion: What to do when your repository server moves to another ip?
This weekend our networking guys decided to change ips for all of our servers. They also changed our subversion server’s ip. This caused some issues in the subversion world with developers who had checkouts pointing to ips instead of hostname, using command similar to:
svn co svn+ssh://192.168.1.10/svn/myrepos/ /home/mycheckout/
Now when they do “svn update” inside the their /home/mycheckout/ directory, they get an error:
We needed to point the checkout to the new ip. Easiest way to do this is to delete your checkout and re-checkout. Unfortunately, some of the developers had a lot of modified files which wasn’t checked in yet. I fixed it by issuing:
find /home/mycheckout -name "entries"|xargs /usr/bin/perl -w -i -p -e "s/192.168.1.10/10.1.1.10/g"
Find command helps us in finding all the files with name “entries” and xargs takes the filename and passes it to perl. To understand what perl command is doing, see this post.
Another method which may be preferred as mentioned in comments is: svn switch Only downside I see with this is that you have to remember what you used originally. If you did checkout as user@192.168.1.10, you would have to pass that to the command below.
Syntax is:
svn switch --relocate svn+ssh://192.168.1.10 svn+ssh://10.1.1.10
I would suggest at this time you switch to using hostname instead of ip.


Also you can use svn switch. It works for me.
Good one! I’ve used a comparable solution in the past to edit CVS control files manually.
You might want to add “grep ‘/\.svn/’” into the pipeline before xargs, to prevent editing a normal file that happens to be named “entries”.
Shoulda used DNS, that’s why it was invented
But yea, “svn switch” would do it.
Thanks for the replies. I have updated the post with svn switch command.
I had to use the svn relocate recently. Thank god it was seamless and easy.
“Only downside I see with this is that you have to remember what you used originally.”
No, you can use ’svn info’ to find that out.
This post comes late for me
Recently I moved my svn to another server and I did a checkout again.
Good post!!
Andrew: good point. I don’t use svn info enough to remember it when I need it. Thanks for your comment.
Antonio:
Thanks for the comment.