Fix authentication, post-commit, and Unicode issues with GitLab.

Review Request #8194 — Created May 29, 2016 and submitted — Latest diff uploaded

Information

Review Board
release-2.0.x

Reviewers

There have been a few major issues reported around GitLab repositories
and account linkage. The biggest issue is that, as of the latest
versions of Review Board (with custom auth forms for hosting services),
it wasn't possible anymore to link a GitLab repository. This was due to
a bad assertion in the new code that was ensuring that a hosting URL
wasn't provided if two-factor auth wasn't available, but that should
have checked the hosting URL against whether the service allows hosting
URLs.

Another issue was that the New Review Request page didn't actually
allow for posting commits. It had hard-coded gitlab.com, instead of
using the specified GitLab server address, meaning that unless you were
trying to use gitlab.com, it was impossible to post existing commits for
review.

The third is that we were treating diff data as Unicode, which would
break on some files. We now treat them as binary data.

Unit tests pass.

Tested account linking against a GitLab Enterprise server, and tested
browsing and posting commits (including ones with Unicode) for review.