mrBliss / snapshot-timemachine

Emacs-mode to step through (Btrfs, ZFS, ...) snapshots of files
GNU General Public License v2.0
23 stars 3 forks source link

snapshot-timemachine

Table of Contents

Snapshot-timemachine provides a polished interface to step through the snapshots of a file made by a third-party snapshot or backup facility, e.g. Btrfs, ZFS, etc.

Out of the box, it can detect snapshots made by Snapper, but it provides a simple interface to add support for other snapshot facilities.

It provides two views: the timemachine and the timeline.

Timemachine

Invoke with M-x snapshot-timemachine. Inspired by git-timemachine. Opens a new buffer viewing the current snapshot of the visited file. You can easily go back and forth in time and view the state of the file in the snapshots you made.

snapshot-timemachine

Available bindings:

Timeline

Invoke with M-x snapshot-timeline. Opens a new buffer listing all the snapshots made of the visited file. The Diffstat column indicates the changes between snapshots. You can step through the list, view snapshots, open diffs, revert a snapshot, etc. You can mark two snapshots as A and B to quickly compare them or to start an ediff or emerge session using them.

snapshot-timeline

Available bindings:

Installation

Customisation

There are a couple of options that can be tweaked:

Your own snapshot system

To use snapshot-timemachine for a snapshot system other than Snapper, you have to define your own function to find the snapshots.

Given an absolute path to a file as only argument, the function must return a list of snapshot structs of the existing snapshots of the file. When snapshot-timemachine-include-current is t, the current version of the file will be added to this list for you, so you don't have to include it.

The snapshot struct has the following slots:

When you have defined your function, store it in the variable snapshot-timemachine-snapshot-finder. That's it!

You can have a look at snapshot-timemachine-snapper-snapshot-finder for inspiration.

Licence

Distributed under the GNU General Public License.