tests: use test harness `hg` in test-hghave.t
This prevents the sub test harness from rebuilding Mercurial.
It shaves ~30s from the test wall time on my machine.
Differential Revision: https://phab.mercurial-scm.org/D6908
synthrepo: use pycompat.xrange
This silences some test-check-pyflakes.t warnings on Python 3.
Differential Revision: https://phab.mercurial-scm.org/D6907