According to TortoiseHG’s source, when you check Discard all changes from merge target (other) revision, it uses the hg debugsetparents command:
hg debugsetparents REV1 [REV2]
manually set the parents of the current working directory
This is useful for writing repository conversion tools, but should be used with care.
Returns 0 on success.
use "hg -v help debugsetparents" to show global options
To use:
hg up <revision-to-keep>
hg debugsetparents <revision-to-keep> <revision-to-throw-away>
hg commit -m "Merge to discard ..."