Multiple undo again...

Jason Harris jason at jasonfharris.com
Fri Jun 4 09:16:55 CDT 2010


On Jun 4, 2010, at 4:11 PM, Paul Boddie wrote:

> Jason Harris wrote:
>> Actually what you are describing is exactly how things are about to work with MacHg. I have a .hgbackup directory which is a Mercurial meta-data repository which contains a snapshot of *everything* before any "changing" hg command. (eg status and log don't do any changing, but addremove, commit, strip, etc do changing.)
>> 
>> Then to undo I just do the update to this snapshot revision by saying Mercurial should work with the .hgbackup dir instead of the .hg dir. If you want to do the redo you just do the update to tip on this parallel .hgbackup dir. And if you want you can move anywhere in the tree of changes in this .hgbackup dir.
>>  
> 
> But does this conveniently support multiple levels of undo? Of course, Mercurial naturally supports multiple level "undo/redo" by design: it's the desire to discard "undone" work that you're interested in, I believe. Browsing the Wiki, I see that what I described as "some kind of cloning plus replaying of unwanted changesets", where I think I actually meant "wanted changesets" since I was talking about discarding unwanted work at that point, it looks like 'hg strip' would be able to support such a thing.

Yes it will support this. Having the snapshot backup model enables multiple levels of undo. Say '.hgbackup' is at rev 45, and you want to undo twice you just update from the '.hgbackup' directory to 43. To redo those changes you just update to 45. The '.hgbackup' is a snapshot of *everything*

Then whenever you don't want those undo / redo's around anymore you just throw the '.hgbackup' directory out. Ie you would do these very session or so.. MacHg will do this when its quit, etc.

Thanks,
  Jas


More information about the Mercurial-devel mailing list