Home in subversion

I’ve mentioned previously that I’ve started putting my /home in subversion. I thought I’d go into how I handle things, as it takes a little adjustment in your thinking to get maximum benefit from this. I used this guide to get me started, and stuck pretty close to it.

What I do is seperate settings files into two groups, common and local (I don’t have any other data in home, that all lives on it’s own partition). Local settings are unique to each machine. Common settings are identical across all the machines the programs are used on. There are a few special cases that live in both worlds, like bash, but I’ll get to how I handle those later.

Each machine on my network has it’s own branch in the svn repo, and in each of those branches are two extra dirs, called “.svncommon” and “.svnlocal”. Inside these there are category dirs like “Bash”, “Devel”, “Internet” etc. that allow me to group together the settings for programs to make management easier. The .svnlocal one is not really necessary, I could just keep all the settings for the local group in the root of home instead of having them in .svnlocal and symlinks to those files in home but I like the symmetry of handling local files the same way as common ones.

Anyway, the category dirs in the common group are setup to use the svn:externals feature, so that they are actually connected to dirs in the trunk of the repo. So the files in ~/.svncommon/Devel are actually located in /trunk/Devel in the repo.

Here is the basic procedure I use to add a new machine to the shared setup (I assume the repo exists already).

  1. First we need to add a branch for the new machine “svn mkdir svn://server/Repo/branches/MACHINE
  2. Then link the homedir to that branch so we can add the files “svn co svn://server/Repo/branches/MACHINE .
  3. Create the two dirs for the local and common files “svn mkdir .svnlocal .svncommon
  4. Setup the links to the common stuff”svn propedit svn:externals .svncommon
    Bash/ svn://$REPO/trunk/Bash
    GuiInternet/ svn://$REPO/trunk/GuiInternet
    Internet/ svn://$REPO/trunk/Internet
    Devel/ svn://$REPO/trunk/Devel
  5. svn ci .
  6. svn up

To add stuff to the repository you simply move it into one of the subdirs of .svnlocal or .svncommon. Then create a symlink to it in ~/ so the program can still access the file. Then “svn add” both the file and the symlink.