2329: WebAPI : diff comments line numbers can be out of sync

robert.********@gmai***** (Google Code) (Is this you? Claim this profile.)
Oct. 12, 2011
What version are you running?

1.6.1

What's the URL of the page containing the problem?

http://reviews.reviewboard.org/r/1082/
http://reviews.reviewboard.org/api/review-requests/1082/diffs/3/files/5857/diff-comments/


What steps will reproduce the problem?
1. Open the first URL
2. Note the line numbers of the diff comments for reviewboard/htdocs/media/rb/js/reviews.js
3. Open the second URL
4. Note the line numbers of the diff comments for reviewboard/htdocs/media/rb/js/reviews.js

What is the expected output? What do you see instead?

The line numbers are different; I would expect them to be the same. In the web page they are 1542 and 1557, while in the API they are 1590 and 1605.

What operating system are you using? What browser?

Server: SLES 11
david
#1 david
The API gives diff comment locations as "row numbers" in the two-column view instead of file line numbers. This is intended behavior.
  • +NotABug
#2 robert.********@gmai***** (Google Code) (Is this you? Claim this profile.)
Any reference in the documentation on how I can convert from these row numbers to file line numbers?
david
#3 david
There's no easy way to do this other than to compute a two-column diff yourself. Which file do you want to associate line numbers with? The new file? The old file?
#4 robert.********@gmai***** (Google Code) (Is this you? Claim this profile.)
I am able to associate with both the new and the old file, that is not a problem. To put this into context, I am working on the Eclipse plugin for ReviewBoard, and part of that effort is displaying the new and old file in a compare editor, with diff comments attached.

Do you have a source code link to where the two-diff column is computed inside RB ? My Python is rusty, but I might be able to figure it out. And I can ask the rest of the questions on the discussion group.
Thanks!

Robert
#5 andrey******@gmai***** (Google Code) (Is this you? Claim this profile.)
Is there any update on this issue? I wrote a utility that runs Findbugs and PMD on the committed code and auto-posts review comments via the API. Of course I realized it's posting on the wrong lines. Is there any reasonable way to figure out what line to post the comment on, if I only know the line number on the right side of the diff?

Thanks,
Andrey