Mercurial doesn’t seem to handle being interrupted particularly well. That, coupled with my tendency to hit ^C when I do something stupid leads to Mercurial ending up in an inconsistent state about once a week, causing me to manually restore my patch queue state with judicious use of `strip` (or otherwise).
I’ve just about had enough of this. A simple hack (that hopefully others will find useful) is to alias `hg` to a script containing:
Sort of evil hack, but does the job (provided you don’t kill the terminal you’re typing in: but I’m yet to meet someone who is suffering from reflexively executing `exit`. Now you can ^C Mercurial all you want and it will blithely ignore you. This seems preferable to it half-doing something, throwing a tantrum, and eating itself…