How can revisions/version control be implemented for web apps' data

version-control

Solution

I've recently implemented just such a system - which uses the concept of superseded records, together with a previous and current link. I did a considerable amount of research into how best to achieve this - in the end the model I arrived at is similar to the Wordpress (and other systems) - store the changes as a new record and use this.

Considering all of the options available, space is really the last concern for authored content such as posts - media files take up way more space and these can't be stored as deltas anyway.

In any case the way that Git works is virtually identical in that it stores the entire content for every revision except that it will eventually pack down into deltas (or when you ask it to).

Going back to 1990 we were using SCCS or RCS and sometimes with only 30mb of disk space free we really needed the version control to be efficient to avoid running out of storage.

Using deltas to save space is not really worth all of the associated aggravation given the average amount of available storage on modern systems. You could argue it's wasteful of space, however I'd argue that it is much more efficient in the long run to store things uncompressed in their original form

- it's faster

- it's easier to search through old versions

- it's quicker to view

- it's easier to jump into the middle of a set of changes without having to process a lot of deltas.

- it's a lot easier to implement because you don't have to write delta generation algorithms.

Also markup doesn't fare as well as plain text with deltas especially when editing with a wysiwyg editor.

Problem

I believe Wordpress stores multiple entries of posts as "revisions" but I think thats terribly inefficient use of space? Is there a better way? I think gitit is a Wiki that uses GIT for version control, but how is it done? eg. my application is in PHP and I must make it talk to GIT to commit and retrieve data? So, what is a good way of implementing version control in web apps (eg. in a blog it might be the post content)

Original source