Using a version control system as a data backend

Posted by JacobM on Stack Overflow See other posts from Stack Overflow or by JacobM
Published on 2010-03-25T20:48:15Z Indexed on 2010/03/25 20:53 UTC
Read the original article Hit count: 361

I'm involved in a project that, among other things, involves storing edits and changes to a large hierarchical document (HTML-formatted text). We want to include versioning of textual changes and of structural changes.

Currently we're maintaining the tree of document sections in a relational database, but as we start working on how to manage versioning of structural changes, it's clear that we're in danger of having to write a lot of the functionality that a version control system provides.

We don't want to reinvent the wheel. Is it possible that we could use an existing version control system as the data store, at least for the document itself? Presumably we could do so by writing out new versions to the filesystem, and keeping that directory under version control (and programmatically doing commits and so forth) but it would be better if we could directly interact with the repository via code.

The VCS that we are most familiar with is Subversion, but I'm not thrilled with how Subversion represents changes to the directory structure -- it would be nice if we could see that a particular revision included moving a section from Chapter 2 to Chapter 6, rather than just seeing a new version of the tree. This sounds more like the way a system like Mercurial handles changes to the structure.

Any advice? Do VCS's have public APIs and so forth? The project is in Java (with Spring) if it matters.

© Stack Overflow or respective owner

Related posts about version-control

Related posts about programatically