Saturday, February 7, 2009

Working with SVN (Subversion) on a local network. Use hostnames when checking out.

Hello everybody,

Firstly, I am working on a new project, "Tiddly Speck" (Working Title), and will return to posting about "Using Ruby to easily scrape/search/spider a web page for "things"" once I have finished the "Tiddly Speck" project.

Now on with the post..

When working with subversion on a local network, I highly recommend using hostnames when performing checkouts.
You can add custom hostnames by configuring your system's hosts file.
If at any point the machine which you were using to checkout from changes its IP address, having used hostnames means you need only reconfigure the entry for the hostname in your hosts file.
If you didn't use hostnames you would either need to reconfigure your network to give the machine the original IP address it had, reconfigure all the .svn entries for the checkout, or re-checkout with the new IP address and merge all your old changes into your new checkout.

Example:
I use my mac mini as my subversion "server" at home.

My hosts file includes:
127.0.0.1     localhost
127.0.1.1 robert-ubuntu-desktop
192.168.0.9 macmini


This means that I can checkout my repository using a command similar to the following:
svn co http://macmini/svn/ my_new_work_area

If at any time my macmini changes its IP address, I only need to edit the macmini entry in my hosts file with the new IP address.

No comments: