Fix issues with interdiff context filtering.

Review Request #7374 — Created June 4, 2015 and submitted

Information

Review Board
release-2.0.x
b522ca3...

Reviewers

There were three bugs found in the interdiff filtering code, uncovered
from reports sent to us.

1. It was possible for an interdiff to filter out all content from the
   diff, depending on where the diff chunk details and content ended up.
   This was the result of an off-by-one in the leading lines of context.

2. It also failed to filter out trailing chunks, due to not taking into
   account the lines of context after the modifications. We now track
   the number of lines of context after the modifications and deduct
   them from the returned range.

3. Last but not least, when determining if a range was valid, we were
   assuming both sides were of equal importance. This wasn't the case.
   We now consider only the ranges valid for the given change type.

Some of the unit tests were failing with these fixes. I've gone over
them and plugged in the new values, which I believe are sane. I've also
added a new unit test for the trailing lines of context.

Unit tests pass.

Tested with all the interdiff tests I have. They looked correct (more
correct, in some cases, now that I've dug into the before/after and what
I'd expect from doing this by hand).

Tested with some broken diffs sent my way. They looked correct after.

Description From Last Updated

redefinition of unused 'FileDiffMigrationTests' from line 1039

reviewbotreviewbot
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/diffviewer/processors.py
        reviewboard/diffviewer/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/diffviewer/processors.py
        reviewboard/diffviewer/tests.py
    
    
  2. reviewboard/diffviewer/tests.py (Diff revision 1)
     
     
    Show all issues
     redefinition of unused 'FileDiffMigrationTests' from line 1039
    
  3. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.0.x (0ded750)
Loading...