Improve diff change indicators for binary files.

Review Request #13725 — Created April 10, 2024 and submitted — Latest diff uploaded

Information

Review Board
release-7.x

Reviewers

For all the files in a diff, we generate little change indicators that
show the proportion of added/changed/removed lines. For binary files,
we'd end up trying to re-parse the diff, and then just draw an empty
circle. This looked particularly weird when the binary file was the only
thing in the diff.

This change updates this so that we generate some fake counts for binary
files, based on whether it's a new, deleted, or updated file. This
results in solid green, red, or yellow circles, rather than just an
empty space.

This also makes it so that if we don't have any raw counts for a diff,
we hide the lines-changed indicator in the change description (this
would previously say something like "Revision 4 ()")

  • Looked at a bunch of change descriptions for added/deleted/updated
    binary files. Saw that the "Diff" field now contained colored circles
    rather than empty spaces.
  • Saw that change descriptions for diffs that contained only empty files
    no longer had an empty set of parentheses after the diff revision
    number.
  • Looked at the diff file index and saw the same.
  • Ran unit tests.

Commits

Files