2573: Diffs not displayed when first diff on page fails to apply

jasper.v********@gmai***** (Google Code) (Is this you? Claim this profile.)
Sept. 29, 2012
What version are you running?
1.6.5

What's the URL of the page containing the problem?
http://<reviewboardaddress>/r/<nr>/diff/?page=4

What steps will reproduce the problem?
1. Upload a diff
2. View results
3. Go to a page where the first diff does not apply correctly

What is the expected output? What do you see instead?

The expected output is a list with files where behind the first file the message "Diff currently unavailable." appears.

Instead the following message is shown below the menu:

The patch to '<file>' didn't apply cleanly. The temporary files have been left in '/tmp/reviewboard.cV7F3w' for debugging purposes. `patch` returned: patching file /tmp/reviewboard.cV7F3w/tmpj5P3tP Hunk #1 FAILED at 1. 1 out of 1 hunk FAILED -- saving rejects to file /tmp/reviewboard.cV7F3w/tmpj5P3tP-new.rej

Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.6.5-py2.6.egg/reviewboard/diffviewer/views.py", line 151, in view_diff
    interdiffset, highlighting, True)
  File "/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.6.5-py2.6.egg/reviewboard/diffviewer/diffutils.py", line 1072, in get_diff_files
    large_data=True)
  File "/usr/local/lib/python2.6/dist-packages/Djblets-0.6.16-py2.6.egg/djblets/util/misc.py", line 157, in cache_memoize
    data = lookup_callable()
  File "/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.6.5-py2.6.egg/reviewboard/diffviewer/diffutils.py", line 1071, in <lambda>
    enable_syntax_highlighting)),
  File "/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.6.5-py2.6.egg/reviewboard/diffviewer/diffutils.py", line 553, in get_chunks
    new = get_patched_file(old, filediff)
  File "/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.6.5-py2.6.egg/reviewboard/diffviewer/diffutils.py", line 375, in get_patched_file
    return patch(filediff.diff, buffer, filediff.dest_file)
  File "/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.6.5-py2.6.egg/reviewboard/diffviewer/diffutils.py", line 243, in patch
    (filename, tempdir, patch_output))
Exception: The patch to '<file>' didn't apply cleanly. The temporary files have been left in '/tmp/reviewboard.cV7F3w' for debugging purposes.
`patch` returned: patching file /tmp/reviewboard.cV7F3w/tmpj5P3tP
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file /tmp/reviewboard.cV7F3w/tmpj5P3tP-new.rej

What operating system are you using? What browser?
Client: Ubuntu 10.04, Firefox.
Server: Ubuntu 10.04, apache2

Please provide any additional information below.

A workaround is to change the "Paginate by" value in the admin settings.
#1 michael.********@unist***** (Google Code) (Is this you? Claim this profile.)
This still happens in version 1.6.10. It seems to come from reviewboard/diffviewer/views.py in method view_diff where a preload of the first file is tried. If the patch doesn't apply cleanly at this first file we seem to get an Exception instead of the usual Error and consequently the whole page isn't loaded. One thing which seems to (crudely) remedy this is the following patch which simply deactivates the preload. I hope you can do something about this. Thanks!
  • +
    --- /usr/lib/python2.5/site-packages/ReviewBoard-1.6.10-py2.5.egg/reviewboard/diffviewer/views.py.0	2012-07-25 15:44:30.000000000 +0200
    +++ /usr/lib/python2.5/site-packages/ReviewBoard-1.6.10-py2.5.egg/reviewboard/diffviewer/views.py.2	2012-08-15 14:37:04.000000000 +0200
    @@ -135,28 +135,28 @@
             # diff immediately and instead saw a spinner, making them feel it was
             # taking longer than it used to to load a page. We just trick the
             # user by providing that first file.
    -        if page.object_list:
    -            first_file = page.object_list[0]
    -        else:
    -            first_file = None
    -
    -        if first_file:
    -            filediff = first_file['filediff']
    -
    -            if filediff.diffset == interdiffset:
    -                temp_files = get_diff_files(interdiffset, filediff, None)
    -            else:
    -                temp_files = get_diff_files(diffset, filediff, interdiffset)
    -
    -            if temp_files:
    -                populate_diff_chunks(temp_files, highlig
david
#2 david
Fixed in master (59101b9).
  • +Fixed