RB4: Ensure that revisions are text before converting to unicode

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

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.

puremourning
puremourning
puremourning
puremourning
  1. Any comment on this? This bug is pretty serious (meaning that you can't post diffs with new files from git-p4 repos)

  2. 
      
puremourning
Review request changed
Status:
Completed
Change Summary:
Pushed to release-4.0.x (99b1e7e)
david
  1. Ship It!
  2.