Update 2023-03-23: Revision functionality has been completely overhauled and now contains a viewer for previous revisions, a number of settings and statistics, as well as pruning functionality to keep the number of kept revisions small. See also this comment.
You can play around with it on the demo site.
I’ve been playing a bit with the idea I outlined in this thread, and made a proof-of-concept for an in-wiki backup that uses the new prerelease makepatches
and applypatches
filter operators to create a backups of tiddlers during save that use as little space as possible.
The actual backup macro is surprisingly short, but took even more surprising amounts of time to get right.
The macro is called each time a tiddler is saved. For that to work, I used the configurable messagecatcher outlined here to intercept the tm-save-tiddler
message and run the macro before passing along the message. For that I created and activated the “Yaisog” PageTemplate that uses $genesis
to include a messagecatcher if configured.
The macro can be called manually, too, e.g. with a button. Since it uses the modified
date to separate backups, no additional backups will be created by calling the macro repeatedly if no changes were made.
There is also a barebones Patches Viewer which will list tiddlers and their backups (I call them patches, from the filters used) and lets you choose one for viewing. The patches are all saved into the $:/patches
namespace. They are associated with tiddlers via their created
field – this way renames should be properly tracked and archived.
My vision for the next steps is a button on the ViewToolbar that pops up a list of backups for the current tiddler which can then be chosen for viewing.
Also desperately needed are controls for deleting and pruning older backups, per tiddler and wiki-wide. I can imagine a button that will delete all backups before day X – which means that all patches must be combined into the backup “origin” to which the differential patches are applied. This “origin” is currently created whenever a tiddler is modified for the first time.
There should also be a calculation somewhere to determine the space taken up by the patches.
So much to do, so little time…
Have a nice day
Yaisog