Closed Bug 1251455 Opened 9 years ago Closed 7 years ago

diff viewer is lying about moved chunks

Categories

(MozReview Graveyard :: Review Board: Upstream, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: dbaron, Assigned: zalun)

References

Details

Attachments

(1 file)

I'm trying to review https://reviewboard.mozilla.org/r/35163/diff/4 , and the diff viewer in MozReview is just blatantly lying.  (It's a classic example of a patch where the diff viewer in MozReview should be better -- lots of moved code, and I'm happy to let MozReview check that chunks are just moved.)

However, if you look at property_database.js, there's a chunk in the old code under "mask": at line 4115 that says "moved to line 6941".  If you click that and go to line 6941 in the new code, you'll see a chunk that looks nothing like it (4 lines long rather than 71 lines long, although the first 3 lines are the same).  So it's lying about both the destination of the move, and the fact that the new code at 6941 is a "move" from elsewhere in the file.  If you scroll up, you will in fact find the chunk -- it was moved to 6732 (and that chunk is 71 lines long).

So there are two problems here:
 * on the left (old) side, the chunk at 4115 should say it was moved to 6732 rather than to 6941
 * on the right (new) side, the chunk at 6941 should not indicate that it was moved from 4115


This bug can lead to unreviewed code landing in our repositories, since the diff viewer is claiming code is existing when it is, in fact, not existing code.
Wow, yeah, that's all kinds of broken.  smacleod, this is another thing we need to fix asap.
Component: General → Review Board: Upstream
Flags: needinfo?(smacleod)
Priority: -- → P1
I'll look into this
Assignee: nobody → smacleod
Flags: needinfo?(smacleod)
Steven suggested I post something here relating to what I'm seeing. I don't know if this is an accident or not, but here goes:

https://reviewboard.mozilla.org/r/56584/diff/4#17

Scroll down to line 76 on the right-hand-side of the diff. It says "moved from line 220".

Clicking that link goes to line 220 on the right-hand-side of the diff (too), which isn't at all like the first chunk you were looking at. It says "moved from line 154" and that link works correctly.

However, if you scroll back up to what was line 220 on the *left-hand-side* of the diff, you will in fact find a line that looks the same. So I think the annotation is correct, but the link points to the wrong point in the diff.

Another fun thing is that if you scroll down further than before, to line 103 on the right-hand-side, that *also* says "moved from line 220", for the same line, with the same problem on the link. Then on line 109 (right-hand-side), we see a pointer to line 219, again pointing to that line on the right-hand-side, for a 2-line hunk thus including line 220. :-\

The line pointers should go to the right line, and ideally there should be some indication that a line that occurred once in the old version of the file has now been duplicated thrice over (with the comment reproduced once).
Assignee: smacleod → pzalewa
I've started to work on the bug. I think the wrong "jumps" are created in ReviewBoard's opcode_generator.py file. Either _find_longes_move_range or _determine_move_range are for some reason adding wrong line numbers to MoveRange object. I will discuss it in more detail in the bug mentioned above (https://hellosplat.com/s/beanbag/tickets/4371/).
Assignee: pzalewa → smacleod
Issue is now fixed upstream in ReviewBoard. I will close the bug when changes will be pulled to MozReview.
"Pushed to release-2.0.x (151e986)"
I will implement the changes from upstream into our fork. This is a temporary solution until we will upgrade the fork.
Assignee: smacleod → pzalewa
Solution provided in the upstream is not solving all of the problems raised above. We might have to split the bug as these might be different issues.
Blocks: 1352340
Attachment #8851663 - Flags: review?(smacleod)
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: