upstream two fixes

This pull request bundles two fixes.

First, if you're having local extensions to hg, the formatting of hg help might have more whitespace, so I extended the parsing of that a bit.

The other commit is a proposed fix to issue #2449.