Update Bitbucket to use the 2.0 API.

Review Request #8816 - Created March 15, 2017 and submitted

Christian Hammond
Review Board
release-2.5.x
1919db8...
reviewboard

This moves us entirely (almost) onto the Bitbucket 2.0 API. The old 1.0
API has a number of bugs, which have bit some users, and 2.0 has
recently been expanded to include most of what we need (without the
bugs and with improved error reporting).

We now use the 2.0 API for retrieving branches, commits, checking the
repository, and validating the user. We can't use it yet for fetching
the contents of files, though, as that's still a 1.0-only feature
(though is being tracked upstream by Bitbucket -- see
https://bitbucket.org/site/master/issues/13690/customer-request-api-20-to-include).

One of the advantages of the new API is that payloads can be limited to
the specific fields needed in a client. We now use this to slim down
communication with Bitbucket.

There's also additional bullet-proofing in here for validating that the
repository is of the correct type, based on the choices selected in the
repository form.

Unit tests passed.

Tested with a handful of repositories (Git and Mercurial, and including
one that triggered crashes in the Bitbucket API). I tested that
repository validation, account linking, branch/commit listing, and
file fetching all work.

Review Bot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/hostingsvcs/tests/test_bitbucket.py
        reviewboard/hostingsvcs/bitbucket.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/hostingsvcs/tests/test_bitbucket.py
        reviewboard/hostingsvcs/bitbucket.py
    
    
  2. 
      
Barret Rennie
  1. 
      
  2. 
      
David Trowbridge
  1. Ship It!
  2. 
      
Christian Hammond
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.5.x (3b9c6c5)
Loading...