Options for keeping revision history?

139 views
Skip to first unread message

si

unread,
May 9, 2021, 12:40:48 PM5/9/21
to TiddlyWiki
I've become kind of interested in keeping a full revision history of my wiki - i.e. be able to see every single change I've made to every tiddler.

I know about http://j.d.revisions.tiddlyspot.com/, which I like a lot, but it has a couple of disadvantages for my use case:
  1. Revisions are only created when you click the save button from the edit toolbar. Most of the time I save tiddlers with Ctrl+Enter. I also use Streams a lot, where again changes made to tiddlers won't be recorded by the plugin.
  2. I use a single html wiki for all my stuff. Presumably having a new tiddler created for every change I make will soon start to inflate and slow down my wiki? Or maybe I am wrong about this?
So I guess I'm interested in whether it is even practical to keep such an extensive history of my wiki use, and if so what options are available?

PMario

unread,
May 9, 2021, 1:12:35 PM5/9/21
to TiddlyWiki
On Sunday, May 9, 2021 at 6:40:48 PM UTC+2 si wrote:
I've become kind of interested in keeping a full revision history of my wiki - i.e. be able to see every single change I've made to every tiddler.
I know about http://j.d.revisions.tiddlyspot.com/, which I like a lot, but it has a couple of disadvantages for my use case:

As far as I know, that's the only plugin which create revisions. And there is the "trashbin plugin" [1]
 
  1. Revisions are only created when you click the save button from the edit toolbar. Most of the time I save tiddlers with Ctrl+Enter.
IMO this can be solved. .. but you'll need to mess with the core EditTemplate ... \define save-tiddler-actions()
  1. I also use Streams a lot, where again changes made to tiddlers won't be recorded by the plugin.
I think, Streams is designed, to be modified a lot and it uses dynamically created tiddler titles. .. So you will probably create a lot of "strange looking titles". So without some heavy support for a "recovery UI" you will get problems there.
  1. I use a single html wiki for all my stuff. Presumably having a new tiddler created for every change I make will soon start to inflate and slow down my wiki? Or maybe I am wrong about this?
IMO it will make the whole thing a lot more complex.
 
So I guess I'm interested in whether it is even practical to keep such an extensive history of my wiki use, and if so what options are available?

I did think about a possibility (just in my mind), that it should possible to store the "diffs only". ... So similar to, what can be seen in the TW import mechanism. Where you can see "the diff" the difference between the newly imported tiddler and an existing one. ...

A similar mechanism would allow us to create something that is called a "patch". ... So it contains the commands, that need to be applied to the existing tiddler, to get the OLD tiddler back. ...

The problem with a mechanism like this, would be, that you'll need to apply the patches in order. .. If 1 patch gets lost, there will be a problem. ...

So the whole handling thing will be complex. .. I didn't think about it in detail.

-mario


si

unread,
May 10, 2021, 8:33:39 AM5/10/21
to TiddlyWiki
Thanks Mario for the comprehensive reply.

I have decided to create my own history-saving macro, which I will use only in specific instances, rather than across my whole wiki. For now I'm just saving data, I will worry about other features in the future.

This is what I have at the moment:

\define save-history()
    <$vars timestamp=<<now "[UTC]YYYY0MM0DD0hh0mm0ssXXX">> >
    <$vars history-tiddler-title={{{ [<currentTiddler>addsuffix[/history/]addsuffix<timestamp>] }}} >
        <$list filter="[<currentTiddler>fields[]]" variable=field-name>
            <$action-setfield $tiddler=<<history-tiddler-title>> $field={{{ [<field-name>addsuffix[-history]] }}} $value={{{ [<currentTiddler>get<field-name>] }}}/>
        </$list>
    </$vars>
    </$vars>
\end

So every time I activate this macro I should get a new "history-tiddler" named <currentTiddler>/history/<timestamp>. Relink titles will make sure that this data remains associated with the correct tiddler.

I am wondering if it would make more sense to use a JSON tiddler to store history? I would do essentially the same thing, but all history for a particular tiddler would be stored in a single tiddler called <currentTiddler>/history as JSON entries (using JsonMangler). Would this be better in terms of performance when I end up with a large number of history-tiddlers, or do you think it makes more sense to stick with what I have done?

Anjar

unread,
May 10, 2021, 10:10:40 AM5/10/21
to TiddlyWiki
Non-plugin alternatives include git and sqlite; both will keep the wiki size low, but neither will have the history directly available in the wiki. Git isn't able to take care of title changes, whereas the SQLite-history follows the toddler (but it needs a server and is still under development)

Best,
Anders

Soren Bjornstad

unread,
May 10, 2021, 3:07:19 PM5/10/21
to TiddlyWiki
On Monday, May 10, 2021 at 9:10:40 AM UTC-5 Anjar wrote:
Git isn't able to take care of title changes

Really? Git normally detects renames just fine unless you massively change the contents at the same time you change the filename. I found some examples in my own folder wiki controlled by Git too.

Anjar

unread,
May 10, 2021, 4:42:48 PM5/10/21
to TiddlyWiki
@Soren you're right, I was only thinking on the single file edition where it would be difficult to follow a tiddler across time if the title is changed

Soren Bjornstad

unread,
May 10, 2021, 6:12:30 PM5/10/21
to TiddlyWiki
Ah, fair enough.

TW Tones

unread,
May 10, 2021, 8:01:52 PM5/10/21
to TiddlyWiki
Si,

Another approach or source on inspiration may be the core plugin Save Trail: Automatically download modified tiddlers which says;

This plugin causes TiddlyWiki to continuously download (as a JSON file) the contents of any tiddler that is manually changed by any of several means:

  • Confirming an edit
  • Deleting tiddlers
  • Imports
  • Renames/relinks
  • Optionally, typing in draft tiddlers can trigger a download

Where appropriate, separate 'before' and 'after' files are downloaded. Configured correctly, the browser will download the files silently in the background, and they can be used as a backup in case of accidental data loss.

However read the warnings!


Regards

Tones

si

unread,
May 11, 2021, 2:14:49 PM5/11/21
to TiddlyWiki
Thank you Tones and Anders for your suggestions.
Reply all
Reply to author
Forward
0 new messages