Running a Linux server under subversion

Blog Topics:

I like putting my servers under subversion control, i.e. treating the entire file system as a "local working copy." That way I can safely try things and be sure that I can go back to a previous configuration. Also, whenever I do some configuration changes (either manually or through a control panel), I can review all the changes, and when I'm satisfied I add a dated entry to a history file and commit / (root).

Workflow

Here's a typical workflow:

  1. Make some changes.
  2. Verify the intended behavior.
  3. Run svn st / to see what has changed in the file system, or svn st . in a subdirectory.
    I use the PuTTY ssh terminal emulator, which allows me to scroll back and to copy text (paths and file names) to the clipboard by Shift-selecting with the mouse, which is very convenient.
  4. Go through the list and check the changes:
    • !: Do svn rm /path/file to confirm the deletion of files that have disappeared.
    • ?: Do svn add /path/file to confirm the addition of new files. Alternatively, do svn add /path --force to confirm the addition of all new files under /path (or even under root, but only after reviewing the entire list!).
    • M: do svn di /path/file or svn di /path to review changes of one file or all files under /path.
  5. Do svn revert /path/file to undo any undesired changes.
  6. Before committing, make sure you only have 'A', 'D', and 'M' changes. You can also leave '?' changes (new files that have not been added to version control yet) in place — these will remain pending.
  7. When everything is ok, then add a dated comment to the history file (copy it to the clipboard) and do svn ci / to commit the file system. svn prompts for a log entry, just paste it from the clipboard.