Fix reuse of previously-used move detection ranges.

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

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).