Modernize the Bitbucket hosting service backend.
Review Request #1702 — Created July 29, 2019 and updated — Latest diff uploaded
This is largely a rewrite of the Bitbucket hosting service backend that aims to throw out old Bitbucket API 1.0 conventions (such as error introspection and pagination workarounds) in favor of API 2.0, and to leverage the modern hosting service support in Review Board 4.0. Much like the recent RB Gateway rewrite, the new `BitbucketClient` class takes care of all communication, standardizing all error handling, URL building, and authentication. It implements API accessors for everything that the service backend needs, and it all goes through the modern HTTP request code. API accessors that deal with paginated payloads now wrap the results using the new `BitbucketAPIPaginator` class, which gives us a single standard way to handle pagination. The service backend no longer directly performs any HTTP requests, instead calling into the API accessors on the client, providing arguments based on the account or repository information and turning the results into the proper objects (or returning them directly). The truncated commits handling for the WebHook push event also leverages the new paginator class, using it to limit the number of pages of results and to simplify the logic, making it less error-prone. The authentication form now rejects Bitbucket usernames comprised of e-mail addresses, which has been a common source of confusion ever since Atlassian changed to having users log in via their e-mail accounts but kept usernames for the Bitbucket API. Documentation has been added all throughout, and unit tests have been updated for the new requirements. Testing Done: Linked an account with Bitbucket successfully (and verified that it provides a useful error when trying to do this with an e-mail address). Configured a repository. Verified it found the correct repository data from the API and set everything up. Browsed for commits. Saw it populate the list of branches and the list of commits correctly. Posted a commit for review. Saw it extracted the information and diff from the commit correctly. Viewed the diff without any issues. Unit tests pass. Reviewed at https://reviews.reviewboard.org/r/10639/
Loading file attachments...