Hi,

first_line is in reference to the line numbers of the file diff resource (
http://www.reviewboard.org/docs/manual/1.6/webapi/2.0/resources/file-diff/).
This number doesn't correspond to either the left or right pane of the
diff, but a combination of the two. If you were to count down the rows of
the diff simultaneously, the row number the line of code falls on is the
value of first_line you are looking for. (i.e. in the file-diff resource,
look at the description of the "lines" field inside a "chunk", the value
you are looking for is 1.Row number of the line in the combined
side-by-side diff. ).

You can find an example function which converts the line number from the
file to the row number here:
https://github.com/smacleod/ReviewBot/blob/490522cfcd2ec8ec3d5a953d0b225344e60e9ad3/bot/reviewbot/processing/review.py#L84

It uses a very slow algorithm though, so I only recommend looking at it to
make things clearer.

On Mon, Sep 17, 2012 at 7:47 AM, soorajchirag <contact.sund...@gmail.com>wrote:

> Hi,
>
> I am looking at the web page:
> http://www.reviewboard.org/docs/manual/1.6/webapi/2.0/resources/review-diff-comment-list/#webapi2.0-review-diff-comment-list-resource
>  to
> know how to post comments using the API on an uploaded diff.
>
> The comment is getting posted by using the parameters specified on the
> page, but the first_line parameter doesn't seem to be working as expected.
> From the web page quoted above:
>
> first_line (required)      Integer      The line number the comment
> starts at.
>
> The issue:
> I am setting the first_line as the one where I want the comment to appear
> on the updated content (right hand column in the browser). I have verified
> that the request being sent to the reviewboard server has the correct
> first_line value. But when I view the review using the Web browser it
> appears at a different line number.
>
> The line number is not correct even if I assume that the first_line is
> based on the line numbers of the original content.
>
> Eg:
> Posted on line number 1594, displayed on:
> 1. New content line number 1468
> 2. Old content line number 1505
>
> If I use the Web browser to post the comment on the intended line (i.e.
> 1594), I see that it uses first_line as 1720!
>
> I am running version 1.6.3.
>
> Is my understanding of the description of first_line incorrect? Any
> suggestions on how to go about figuring out the cause?
>
> Thanks,
> Sundeep
>
> --
> Want to help the Review Board project? Donate today at
> http://www.reviewboard.org/donate/
> Happy user? Let us know at http://www.reviewboard.org/users/
> -~----------~----~----~----~------~----~------~--~---
> To unsubscribe from this group, send email to
> reviewboard+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/reviewboard?hl=en

-- 
Want to help the Review Board project? Donate today at 
http://www.reviewboard.org/donate/
Happy user? Let us know at http://www.reviewboard.org/users/
-~----------~----~----~----~------~----~------~--~---
To unsubscribe from this group, send email to 
reviewboard+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/reviewboard?hl=en

Reply via email to