TMSU icon indicating copy to clipboard operation
TMSU copied to clipboard

Undo command

Open ghost opened this issue 9 years ago • 2 comments

First of all I'm sorry for overwhelming you with new issues. It's just that I'm using TMSU a lot these days and I have some ideas.

What about implementing an undo command? Sometimes I make mistakes when issuing tmsu commands that may take some time to fix manually (for example removal of many unwanted tags, especially when incorrectly pasting data from the clipboard). It would be easier instead doing something like:

tmsu undo

Perhaps this can be implemented simply by creating a .tmsu/db.bak or .tmsu/db~ file before updating the database.

What do you think?

ghost avatar Jul 02 '16 14:07 ghost

Hmm, interesting idea, not sure how it could be easily executed. Creating a backup of the database file would be too costly and will potentially slow down TMSU to the point of unusability. However I don't see why it wouldn't be possible to write some kind of journal which could then be used for reversing operations.

oniony avatar Jul 13 '16 09:07 oniony

I mentioned this in a comment on another issue, but I had similar concerns mucking up my database, so I just started keeping an sql dump of the database in a git repo:

$ sqlite3 .tmsu/db .dump > .tmsu/db.sql
$ git commit -a -m "tmsu: Update database"

Then you can just revert to an earlier version by checking out an earlier version of db.sql and

$ sqlite db < .tmsu/db.sql
$ mv db .tmsu/db

Wrapping this all up in a script or git hook or whatever makes this pretty painless.

xelxebar avatar Aug 16 '16 23:08 xelxebar