RB4: Ensure that revisions are text before converting to unicode

Review Request #12798 — Created Jan. 23, 2023 and submitted — Latest diff uploaded

Information

Review Board
release-4.0.x
1378d8b...

Reviewers

In commit b972f20c55, the diff parser was refactored to remove
DiffParser.get_orig_commit_id(). As aprt of that, a regression was
introduced into create_filediff() that meant whenever the parent revision
was an instance of Revision (rather than a str or bytes), we had a crash
in convert_to_unicode.

The parent revision can be a Revision object specifically whan it is
PRE_CREATION, such as when adding a new file to a Perforce repository.

This change re-introduces the coersion to string of the
parent_source_revision which was lost in the refactoring.

Fixes https://hellosplat.com/s/beanbag/tickets/4988/.
NOTE: A slightly different patch is required for RB5.

See also https://reviews.reviewboard.org/r/12799/

Re-do the steps that trigger the issue in https://hellosplat.com/s/beanbag/tickets/4988/. PASS

I tried to run the nose tests, and mostly they pass, but then the Perforce tests just hang. There seems to be some local setup required, but I couldn't find any info on setting up the environemnt that the tests expect.

dev-requirements.txt
setup.py
docs/manual/admin/configuration/repositories/subversion.rst
docs/manual/admin/installation/linux.rst
reviewboard/__init__.py
reviewboard/attachments/mimetypes.py
reviewboard/reviews/ui/text.py
reviewboard/static/rb/css/pages/reviews.less
reviewboard/static/rb/js/accountPrefsPage/views/apiTokensView.es6.js
reviewboard/static/rb/js/pages/models/diffViewerPageModel.es6.js
reviewboard/static/rb/js/pages/models/tests/diffViewerPageModelTests.es6.js
reviewboard/static/rb/js/pages/views/diffViewerPageView.es6.js
reviewboard/static/rb/js/pages/views/tests/diffViewerPageViewTests.es6.js
reviewboard/static/rb/js/utils/urlUtils.es6.js
reviewboard/templates/diffviewer/view_diff.html
Loading...