Automatic file revision on upload

I need to create a secure remote connection to a couple of files (SFTP, WebDAV/HTTPS,…).

Users need to connect and edit those files by downloading->editing->uploading-replacing or, even better, by editing them in place (if WebDAV).

The server (Linux or as a last resort Mac OS X Server 10.6) should create revisions everytime files are updated/replaced: Is it possible?

Any suggestions would be greately appreciated.


You can use inotify cron(incron) and git(fast version control system)

Install icron:

sudo apt-get install incron

Install git:

sudo apt-get install git-core

Allow root use incron:

echo "root" > /etc/incron.allow

Create git repository:

mkdir /git
cd /git
git init

Create script to auto commit /usr/local/sbin/git-autocommit:

#!/bin/bash

REP_DIR="/git"
NOTIFY_DIR="/srv"

cd $REP_DIR
GIT_WORK_TREE=$NOTIFY_DIR /usr/bin/git add .
GIT_WORK_TREE=$NOTIFY_DIR /usr/bin/git commit -a -m "auto"

Add incron rules:

sudo incrontab -e
/srv IN_MODIFY,IN_CREATE,IN_MOVED_FROM,IN_MOVED_TO /usr/local/sbin/git-autocommit

I like git and Ubuntu)