Update Bitbucket to use the 2.0 API.
Review Request #8816 — Created March 15, 2017 and submitted — Latest diff uploaded
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.