Fix reuse of previously-used move detection ranges.

Review Request #8795 — Created March 3, 2017 and submitted

Information

Review Board
release-2.0.x
10fe27c...

Reviewers

When attempting to detect moved ranges in diffs, it was possible for
multiple remove groups to be found for a line, and for the wrong group
to be used. When this happened, an existing move range would also be
found and used, and this could overshoot and mark incorrect lines as
moved. Even when this didn't happen, the same block could appear to have
moved more than once, without any proper cross-referencing on the other
end of the move.

This change makes an attempt to fix this by tracking inserted lines that
have already been used in a move and making them ineligible for future
moves. That prevents the incorrect existing move ranges from being
reused and overshooting, and it prevents lines from having multiple move
blocks they're a part of.

This still needs additional real-world testing before it can go in.

Unit tests pass.

Tested with some real-world diffs, including one that was triggering
some bad move detection issues (as shown in the bug report).

reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/diffviewer/opcode_generator.py
        reviewboard/diffviewer/tests.py
    
    Ignored Files:
        reviewboard/diffviewer/testdata/move_detection/bug-4371-old.js
        reviewboard/diffviewer/testdata/move_detection/bug-4371-new.js
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/diffviewer/opcode_generator.py
        reviewboard/diffviewer/tests.py
    
    Ignored Files:
        reviewboard/diffviewer/testdata/move_detection/bug-4371-old.js
        reviewboard/diffviewer/testdata/move_detection/bug-4371-new.js
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.0.x (151e986)
Loading...