Make "Discard all changes from merge target" (aka. debugsetparents, "Dummy Merge") harder to accidentally do.
Created originally on Bitbucket by datallah (Daniel Atallah)
We ran into an issue where somebody accidentally checked the //"Discard all changes from merge target"// (hg debugsetparents) checkbox during the merge process, causing a subtle bug to be introduced (and quite a bit of time to be spent trying to figure out what had happened).
Initially, I thought "Why the heck would anyone ever want to do that?!", but after I looked at some mailing list posts, I see that there are some use cases where this is a reasonable thing to do - but you really need to know what you're doing and that it isn't going to screw stuff up.
I also found [[873| Issue #873 (closed)]], which is how the checkbox in the Merge dialog came about (and I would agree that it makes sense from a workflow for the Merge dialog to be where one would perform such a function).
Given that this is a special use function, and that the accidental usage could result in a problem that could be very difficult to detect, my hope is that it can be made harder to accidentally use.
I can think of a couple ways (actually perhaps both at the same time would be good) that this could be done:
- Move the checkbox in the Merge dialog into a collapsed "Options" or "Advanced" section (like the "Options" section in the Update dialog.
- Show a warning alert when the user is about to perform a merge with the functionality enabled. Perhaps something like //"Warning: You have chosen to make a Dummy Merge - the changes from revision 11deadbeef11 and all parents will be discarded. Are you sure this is what you want to do?"//
I also wonder if there is a way that we can detect when a Dummy Merge has been done so that we can use a hook to notify us that we need to review the merge?