Ever wish you could go back several saves in a document or piece of code? You can mount Subversion repositories using WebDAV to generate a new revision each time you save a file!
I run into this during exploratory programming a lot. I’ll break something while hacking away, and not have a means of going back should I lose my undo buffer, etc. My exploratory code changes rapidly as I thrash out the API or technique I’m trying apply, and so explicit version control would be a real drag.
Enter Subversion! If you flip on SVNAutoversioning in your Apache config, you can mount your repository as a WebDAV share, and a new revision will be created for each file save:
DAV svn
Anonymous_NoUserID off
Anonymous_MustGiveEmail off
Anonymous_VerifyEmail off
Anonymous_LogEmail off
Anonymous dacc
AuthName "dacc"
AuthType Basic
AuthBasicProvider anon
Order Deny,Allow
Allow from all
Require valid-user
SVNPath /Users/dan/sandbox.repo/
SVNAutoversioning onI only run this webserver for local access (”Listen 127.0.0.1:80″), so I enabled an anonymous login.
I created the SVN repo like usual:
{dan@godel ~}$ svnadmin create sandbox.repo
Here’s an example of the whole thing working:
{dan@godel ~}$ df | grep sand http://localhost/sandbox/ 0 0 0 0% /Volumes/sandbox {dan@godel ~}$ ls -lad sandbox lrwxr-xr-x 1 dan staff 16 Oct 13 13:41 sandbox -> /Volumes/sandbox {dan@godel ~}$ svn co -q file://`pwd`/sandbox.repo sandbox.co {dan@godel ~}$ echo "// foo" >> sandbox/h5_probe.c {dan@godel ~}$ svn up sandbox.co U sandbox.co/h5_probe.c Updated to revision 1783. {dan@godel ~}$ svn diff -r 1782 sandbox.co Index: sandbox.co/h5_probe.c =================================================================== --- sandbox.co/h5_probe.c (revision 1782) +++ sandbox.co/h5_probe.c (working copy) @@ -56,3 +56,4 @@ // foo // foo +// foo {dan@godel ~}$ rm sandbox/h5_probe {dan@godel ~}$ touch sandbox/new {dan@godel ~}$ svn up sandbox.co D sandbox.co/h5_probe A sandbox.co/new Updated to revision 1785. {dan@godel ~}$
The feature is documented here, but I only turned it up on Google after explicitly searching for the config directive.
Enjoy!


