Update Bitbucket to use the 2.0 API.

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

Information

Review Board
release-2.5.x
1919db8...

Reviewers

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.

reviewbot
  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. 
      
brennie
  1. 
      
  2. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.5.x (3b9c6c5)