Update the Mercurial hgweb support for Python 3.x and Review Board 4.0.
Review Request #10931 — Created March 2, 2020 and submitted
The Mercurial hgweb backend had a couple of compatibility problems that
prevented it from working on Python 3 and Review Board 4.0. It was
trying to parse JSON payloads in the form of byte strings, which is not
supported on Python 3. Instead, we needed to ensure we were providing
Unicode strings. A handy new_get_http_json()
method now does the work
of ensuring we're using the correct types.When building commits, it was still passing a
base_commit_id=
parameter to theCommit
constructor, which has been removed in
Review Board 4.0. This was missed before due to the lack of unit tests
for the hgweb support.Since we now have a
_get_http_json()
method that handles JSON API
requests in a more standardized way, we're also in a better position to
future-proof by checking if endpoints are implemented (comparing a payload
tob'not yet implemented'
) and then returningNone
. This ensures
we don't break with older versions of Mercurial now, and that going
forward we can introduce support for newer APIs without outright breaking
on version that lack them.To ensure we have working compatibility now and in the future, this
change also adds unit tests that cover the hgweb communication.
Manually tested loading branches and commits, posting a change for
review, and viewing a diff.Unit tests pass on all supported versions of Python.
- Change Summary:
-
Removed an unused import.
- Commits:
-
Summary ID 99bd284c930240fcbbf59f1e0f8576348ab91d32 cfc5b6dca34e491e651f3b0ac4749baa94d1ac6c
Checks run (2 succeeded)
- Change Summary:
-
Added formal support for "not yet implemented" responses to APIs, fixing a logging statement that occurred with Mercurial 3.9.
- Description:
-
The Mercurial hgweb backend had a couple of compatibility problems that
prevented it from working on Python 3 and Review Board 4.0. It was trying to parse JSON payloads in the form of byte strings, which is not supported on Python 3. Instead, we needed to ensure we were providing Unicode strings. A handy new _get_http_json()
method now does the workof ensuring we're using the correct types. When building commits, it was still passing a
base_commit_id=
parameter to the Commit
constructor, which has been removed inReview Board 4.0. This was missed before due to the lack of unit tests for the hgweb support. + Since we now have a
_get_http_json()
method that handles JSON API+ requests in a more standardized way, we're also in a better position to + future-proof by checking if endpoints are implemented (comparing a payload + to b'not yet implemented'
) and then returningNone
. This ensures+ we don't break with older versions of Mercurial now, and that going + forward we can introduce support for newer APIs without outright breaking + on version that lack them. + To ensure we have working compatibility now and in the future, this
change also adds unit tests that cover the hgweb communication. - Commits:
-
Summary ID cfc5b6dca34e491e651f3b0ac4749baa94d1ac6c 7cab3e568d2e92e51968011a15f6e9c82e4f65a1