Ensure Unicode arguments for file fetching and bytes for results.

Review Request #10503 — Created April 3, 2019 and submitted — Latest diff uploaded

Information

Review Board
release-4.0.x

Reviewers

This adds some type safety for Repository.get_file() and
Repository.get_file_exists(), ensuring that the arguments coming in
are all Unicode strings. It then checks that the results from the
hosting service or SCMTool are bytes. This ensures we're always working
with the data types we're expecting.

This required some fixes in a few of the hosting services and SCMTools,
casting string types for comparisons and for the results.

Unit tests pass on Python 2.7 and 3.7 (with other in-progress changes).

Diff Revision 2 (Latest)

orig
1
2

Commits

First Last Summary ID Author
Ensure Unicode arguments for file fetching and bytes for results.
This adds some type safety for `Repository.get_file()` and `Repository.get_file_exists()`, ensuring that the arguments coming in are all Unicode strings. It then checks that the results from the hosting service or SCMTool are bytes. This ensures we're always working with the data types we're expecting. This required some fixes in a few of the hosting services and SCMTools, casting string types for comparisons and for the results.
a1827ab8315fb9dab0ff169f999431d5bb1760c8 Christian Hammond
reviewboard/hostingsvcs/beanstalk.py
reviewboard/hostingsvcs/kiln.py
reviewboard/scmtools/core.py
reviewboard/scmtools/cvs.py
reviewboard/scmtools/git.py
reviewboard/scmtools/models.py
reviewboard/scmtools/bzr/__init__.py
reviewboard/scmtools/tests/test_cvs.py
reviewboard/scmtools/tests/test_git.py
reviewboard/scmtools/tests/test_hg.py
reviewboard/scmtools/tests/test_perforce.py
reviewboard/scmtools/tests/test_repository.py
reviewboard/scmtools/tests/test_svn.py
Loading...