It’s been about a year since I created the Mercurial nextMerge revsets alias. It has worked well, but recently the complex Enterprise Web Library repository exposed some flaws, especially the script’s obliviousness to the need for recursion when delving down the graph to determine the safe merges that must be done in preparation for a “no-op” merge. I’ve just published a new version that fixes all known flaws. It deals with the recursion issue not by actually doing recursion (which isn’t possible with revsets), but by returning multiple changesets to let the user know that nextMerge must be rerun.

Here’s the updated code, which you can drop into your Mercurial configuration file: