Update the Gerrit hosting service to use the new client support.

Review Request #10930 — Created March 2, 2020 and submitted — Latest diff uploaded


Review Board


The Gerrit hosting service had some compatibility issues with Python 3,
and this was due to a queryset ordering discrepency issue that was
solved in Review Board 4.0's hosting service client rewrite.

Rather than take the easy route and apply the same fix to Gerrit's code,
this change updates the Gerrit codebase to make full use of the modern
client support. We now use the request/response capabilities in that
rewrite to better control how authentication is performed and to use the
standard methods for performing HTTP requests, allowing us to remove the
custom api_* request methods.

Since Gerrit's API has a security-related quirk where it prefixes JSON
payloads with a string we have to filter out, we still needed a way to
strip this out in a standard way. Previously, we overrode a private
method in HostingServiceClient to do this, which wasn't future-proof.
Now, as part of this change, a HostingServiceClient can designate a
subclass of HostingServiceHTTPResponse to use for all responses, which
the Gerrit implementation uses in order to strip out this prefix when
requesting a JSON-deserialized response.

Manually tested linking a new repository and account, viewing branches,
listing commits, and posting commits for review.

Unit tests pass.