If you run an SVN server on your network and you also run DHCP, you’ll know that at some point the DHCP lease for the IP address of your SVN server will expire, and (unless you have reserved an IP address for it in the DHCP admin) the next IP address allocated to that server could be different from the last one.
This is fine for most day to day work. IP addresses get allocated and reallocated in the background all the time, and mostly you don’t need to know if anything changes. However, if you have files checked out of an SVN repository and the IP address of the SVN server changes you are going to get an error when you try to check the files back in.
The reason for the error is that the IP address of the SVN server is hardcoded into the
entries file in each
\.svn folder. In case you didn’t know, SVN clients create a hidden folder called
\.svn at each level of the folder tree you checked out. If you want to check the folder tree back in you will need to change the embedded IP addresses. The problem is, there could be a lot of files to change.
Thankfully there is a simple way to make these changes programmatically:
- Open up a
- cd to the root folder of your SVN repository
- Type in the following command:
find ./ -name entries -print0 | xargs -0 perl -pi -e 's/OLD IP/NEW IP/'
And that’s it, all references to the old IP address have now been changed to the new IP address.