changegroup: initialize the state variable a bit earlier
This will make the next patch much easier.
Differential Revision: https://phab.mercurial-scm.org/D5732
tests: conditionalize test output on Python 3.7
Python 3.7 changed behavior of urllib.parse.quote() from RFC 2396
to RFC 3986 and ~ is now in the set of reserved characters and
isn't escaped.
We conditioanlize test output accordingly.
Differential Revision: https://phab.mercurial-scm.org/D5717