NextWiki's current changes.log system is OK, but not great. There are significant issues with it, which basically mirror the problems of the mbox format:
An unrelated problem NextWiki currently has which my proposed scheme could also solve is atomic rewriting of pages, so that people don't get blank or incomplete pages when they load them in the middle of a change.
My solution is to convert the changes.log file into a Changedir, somewhat similar to djb's Maildir scheme.
A changedir contains a directory for every file under revision control, in which each revision of that file is stored. It also contains a directory called .tmp
and a directory called .all
. The rôles of these folders will be explained later.
Each directory for a file has a name which is the same as that file itself, and contains timestamp-named files. (I recommend ISO 8601 for this as it sorts correctly ASCIIbetically.) Each of these timestamped files contains the entire source of a version of a file. (I'm not sure where to store metadata. More on that later.) Writing to the version-files is done atomically, as we'll see.
To make a revision to a page and store it in revision control, the PUT handler should do this:
.tmp
. It doesn't matter what the name is as long as it's unique, but in practice it will probably be a timestamp together with the pathname of the page, and perhaps the author..tmp
directory.This brings up the question of how to deal with commit metadata. The best idea I'm able to think of is to create a separate file for each revision for commit metadata. Those should be stored in .all
, so a "recent changes" page can work for all pages on the site.
This system takes advantage of filesystem hard-links, so each revision is only stored on disk once and used for both public file access and for revision control.
There's a file called info.html which bob
creates at 2013-02-27T10:23:43Z. When he creates it:
Changedir/info.html
is created.Changedir/.tmp/uniquename
. That file is then hard-linked to Changedir/info.html/2013-02-27T10:23:43Z
, and to info.html
. Then it's unlinked from .tmp
.Changedir/.all/2013-02-27T10:23:43Z-info.html
.When john
comes along later to edit info.html
, the process is much the same, but this time Changedir/info.html
doesn't need to be created, of course, because it already exists.
ProblemsOS X still kinda doesn't like colons in file names; a relic of the System 1 days. Could be solved by breaking ISO 8601 a bit and using hyphens instead of colons.
Still doesn't solve the problem of nuking other peoples' edits any better than ^B does.
<ins><p class=a></ins><del><p class=b></del> ... </p>
. In my (admittedly limited) experience the similar HTML Diff by Richard Cyganiak and Ian Bicking is better in both regards.