1059: post-review.py does not properly upload diffs for binary files in Perforce

max.r*****@gmai***** (Google Code) (Is this you? Claim this profile.)
April 17, 2009
585
What's the URL of the page containing the problem?
It's not public.

What steps will reproduce the problem?
1. Create a Perforce changelist containing several modified binary files.
2. Run post-review.py to upload the diffs of that changelist.

What is the expected output? What do you see instead?
I expect to see diff entries for all binary files in the new review request.
Instead, I only see a diff for the first binary file.

What operating system are you using? What browser?
Windows XP, Firefox, ReviewBoard 1.0 beta 2.

Please provide any additional information below.

I tracked down and fixed the problem in post-review.py.
Actually, the first issue was a crash for the first binary file,
because a newline was missing when matching a string "Files ... differ".
The problem described above was caused by a missing newline
in the replacement string "Binary files ... differ".
The changes are in lines 1407 and 1408 in the attached file.
#!/usr/bin/env python
import cookielib
import difflib
import getpass
import mimetools
import ntpath
import os
import re
import shutil
import simplejson
import socket
import subprocess
import sys
import tempfile
import urllib
import urllib2
from optparse import OptionParser
from tempfile import mkstemp
from urlparse import urljoin, urlparse
try:
    from hashlib import md5
except ImportError:
    # Support Python versions before 2.5.
    from md5 import md5
# This specific import is necessary to handle the paths for
# cygwin enabled machines.
if (sys.platform.startswith('win')
    or sys.platform.startswith('cygwin')):
    import ntpath as cpath
else:
    import posixpath as cpath
###
# Default configuration -- user-settable variables follow.
###
# The following settings usually aren't needed, but if your Review
# Board crew has specific preferences and doesn't want to express
# them with command line switches, set them here and you're done.
# In particular, setting the REVIEWBOARD_
chipx86
#1 chipx86