Multiple level undo/redo for Mercurial

hg-multiundo supports multiple levels of undo and redo for any Mercurial operation. [1] The extension provides two commands: hg undo and hg redo for undoing a change and redoing it, respectively.


hg-multiundo is configured in the multiundo section. The configuration elements that are used are:

The level of undo states being maintained. hg-multiundo will save the last undocount states on disk to undo/redo.

Technical details

The undo/redo state is hooked into Mercurial's opener, which Mercurial internally uses for all its file read/writes and using that we can discriminate what files to back up before a change is written to it.

All the undo state files are saved inside .hg/multiundo/ directory. The undo files are not meant to be edited by hand, but only through the use of the undo and redo commands.

Known issues

  • The purge extension does not use Mercurial's opener concept as a file system entry point, so any use of hg purge will not be undo-able.
[1]See the known issues list at the bottom.