commands: check for modheads being None
Python 2 allows the > operator to be used with a None and an
int. Python 3 does not. So we need to ensure the value isn't None
before comparing with >.
Differential Revision: https://phab.mercurial-scm.org/D5702