Modernize the Bitbucket hosting service backend.

Review Request #10639 — Created July 19, 2019 and submitted

chipx86
Review Board
release-4.0.x
f5ad059...
reviewboard

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.

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.

Description From Last Updated

E722 do not use bare except'

reviewbotreviewbot

F401 'reviewboard.hostingsvcs.bitbucket.Bitbucket' imported but unused

reviewbotreviewbot

F841 local variable 'ctx' is assigned to but never used

reviewbotreviewbot

F841 local variable 'ctx' is assigned to but never used

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

flake8

chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-4.0.x (3176dd0)
Loading...