Thanks. This snippet is definitely useful.
On Tuesday, 18 September 2012 00:31:52 UTC+5:30, Steven MacLeod wrote:
> first_line is in reference to the line numbers of the file diff resource (
> 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:
> 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
> > wrote:
>> I am looking at the web page:
>> 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.
>> 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?
>> Want to help the Review Board project? Donate today at
>> Happy user? Let us know at http://www.reviewboard.org/users/
>> To unsubscribe from this group, send email to
>> For more options, visit this group at
Want to help the Review Board project? Donate today at
Happy user? Let us know at http://www.reviewboard.org/users/
To unsubscribe from this group, send email to
For more options, visit this group at