Well that was fun.

I never liked the fact that Citadel's wiki module required shell calls to diff(1) and patch(1) to create and retrieve wiki version history.  About a year ago I noticed that libxdiff exists and can do the same thing.  Since I decided that the Wiki module is going to be the next thing I work on in WebCit-NG, it followed that now is the time to make that change.  It took about a week, including a lot of failed experiments with "newer" versions of the library, but in the end I got what I wanted.

I have to admit I'm rather proud of the format we use to store the history.  We keep a named history document, store it in MIME multipart, and each part is a diff containing the changes required to roll a document back to the previous revision.  The "filename" contains metadata for that version.  So to get any version, you start with the current version, then go through each part running the patches until you get to the revision you want, then stop.

And now it's fast!  And of course more secure since there's no way someone can sneak in with a shell or filesystem vulnerability.  All that's left to do now is expose it using REST semantics.  I'm thinking about using the version control stuff in DAV from RFC3253 ... but damn I'd have to handle all of that XML crap again.

Reply via email to