Fix diff fragment header expansion issues.

Review Request #6889 — Created Feb. 1, 2015 and submitted — Latest diff uploaded

Information

Review Board
master
6a71060...

Reviewers

Previously diff fragments would sometimes expand to the incorrect
place. This is beacuse the generated header information was using
original/patched line numbers instead of the virtual (unified original
and patched) line numbers. Header generation has been modified to use
these line numbers and the issue has been fixed.

Headers also used to sometimes select headers to expand to. The code
that searched for headers wasn't taking into account the difference
between the original/patched line numbers, which are what the headers
use, and the virtual line numbers. This would happen if a deletion or
insertion chunk was above the flagged comment lines.

Update the diff fragment template to allow the left header (which
corresponds to the original file) to be expanded to.

Remove dead code for generation headers from the
get_file_chunks_in_range function. The logic for header generation
wasn't quite right and the only caller of the function is using better
logic to find header information.

Add a unit test to test that the line numbers generated by the new
get_last_header_before_line function are both before the requested
line and have the correct unified line number.

Ran unit tests.

Manually tested the diff fragments with lines flagged that had deletes
and inserts above them. They expanded to the proper locations.

Tested expansion of the left-side of the fragment. It was expandable
and expanded to the correct position.

    Loading...