Redo the Mercurial test suite for better speed and consistency.

Review Request #10677 — Created Sept. 2, 2019 and submitted — Latest diff uploaded


The Mercurial test suite went against a lot of our standard conventions
and best practices for unit tests. It used camelCase for test function
names in many places, had incorrect function orders and docstrings, and
didn't make use of assertion functions like assertIn(), instead using
less useful calls like assertTrue(... in ...).

It was also slow, largely due to the use of expensive cloning operations
for every single unit test (when, for the hgsubversion tests at least,
only one was needed).

This change reworks the file to follow our conventions and to speed
everything up in the process. The test suite now resembles other test
suites in our products, and many of the expensive operations have been
simplified or moved to setUpClass().

The hgsubversion tests now create and populate a master repository and
run svnserve once for the entire test suite, instead of per-test.
This shaves a lot of time off the test runs and helps avoid port
conflicts with svnserve.

When cloning, we now pass --stream to hg clone to force it to use a
different cloning method that is less CPU and I/O-intensive, shaving a
pretty large amount of time off our tests in total.

Committing files to Mercurial during tests is also made faster by
consolidating the adding and committing of a file into one command.

In total, this shaves about 40 seconds off our test run, and prepares us
for future unit tests.

Unit tests pass on Python 2.7 and 3.5-3.7.