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

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

Information

Review Board
release-4.0.x

Reviewers

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.

Summary ID
Update the Gerrit hosting service to use the new client support.
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.
47c2fbc0612516f95331424809878054d94f6be7
Description From Last Updated

F821 undefined name 'url'

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-4.0.x (ba49ee6)