3710: reviewboard diff viewer shows binary file contents for unchanged perforce files

mgulick
What version are you running?
Reviewboard 2.0.8

What's the URL of the page containing the problem?
http://reviewboard/r/ID/diff/#

What steps will reproduce the problem?
1. Using an old version of rbtools (0.4.3)
2. p4 edit some_binary_file.gif
3. post-review

What is the expected output? What do you see instead?
The diff viewer should print that the file is unchanged.
Instead, it prints the binary contents of the file.

What operating system are you using? What browser?
Debian 7 (wheezy), Chrome 37

Please provide any additional information below.
This issue doesn't happen with newer rbtools, but that is because binary files in Perforce seem to be completely ignored in the newer version of rbtools (see http://code.google.com/p/reviewboard/issues/detail?id=3659)

If the binary contents differ, the diff will contain the line "Binary files a and b differ", so reviewboard will know that the file is binary.  However, when the files are identical, no such line is included in the diff.  Instead, all that appears is the line:

 ==== //depot/file.gif#1 ==M== //depot/file.gif ====

This is no way to indicate to the reviewboard server that the file is binary.  It should be possible to find this from perforce itself (e.g. "p4 fstat FILE" indicates that the type is binary/xbinary).

To work around this issue, I'm adding the line "Binary files a and b differ" to the diff for binary files that are identical.

Feel free to change this to an enhancement if you feel it does not qualify as a defect.