Proposal: backup hook, trash, and multiple undo

Matt Mackall mpm at selenic.com
Tue Jun 8 10:15:21 CDT 2010


On Mon, Jun 07, 2010 at 08:57:26PM -0400, Greg Ward wrote:
> On Mon, Jun 7, 2010 at 10:23 AM, Matt Mackall <mpm at selenic.com> wrote:
> > Jens' mention of the OS X trash can got me thinking about how we'd
> > implement such a thing, and here's what I came up with:
> >
> > Backup hook:
> >
> > A standard hook called "backup" that gets called whenever a destructive
> > operation gets called. It operates in a couple different modes:
> >
> > type=file
> > operation=rm|update|merge|revert|qdelete|...
> > path=/path/to/file/being/clobbered
> 
> What's the common thread here? hg is deleting any file, or deleting a
> file in the working copy, or deleting a file that isn't already saved
> in a changeset somewhere?

File changes that could result in data loss.

> I have a hard time seeing "hg merge" and
> "hg qdelete" being equally destructive: the only time "hg merge" can
> irreversibly discard data is if you run it with -f.  (Right?)  But
> qdelete is irreversible by default -- much more dangerous.

merge can mangle files that get merged, which is sometimes just as
good as deleting them. We currently store a .orig file (which clobbers
any existing .orig file), this would also hand off that file to the
backup hook.

(Typical trash cans also clobber identical files.)

-- 
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial-devel mailing list