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:// /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/"

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 [email protected], you would have to pass that to the command below.

Syntax is:

svn switch --relocate svn+ssh:// svn+ssh://

I would suggest at this time you switch to using hostname instead of ip.

10 thoughts on “Subversion: What to do when your repository server moves to another ip?

  1. Bill Karwin

    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”.

  2. Vee

    Shoulda used DNS, that’s why it was invented ๐Ÿ™‚

    But yea, “svn switch” would do it.

  3. Sunny Walia Post author

    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.

Leave a Reply

Your email address will not be published. Required fields are marked *