Re: Creating a new comment, first_line not being used correctly?

2012-09-18 Thread soorajchirag
Thanks Christian.

Does it look feasible to add a set of parameters that allow the clients to 
specify real line numbers?

If someone could point me to the portion of the code where we receive the 
request I could dig into providing such parameters (provided the approach 
is acceptable).

Thanks,
Sundeep


On Tuesday, 18 September 2012 00:29:09 UTC+5:30, Christian Hammond wrote:
>
> Hi,
>
> The line number is not actually the line of a file, but rather the row of 
> the side-by-side diff. This is for legacy reasons. Once upon a time, we 
> didn't have real line number information.
>
> You'd have to figure out which row (1-based) corresponds to the line you 
> care about and use that number. We should document that better.
>
> Christian
>
> -- 
> Christian Hammond - chi...@chipx86.com 
> Review Board - http://www.reviewboard.org
> VMware, Inc. - http://www.vmware.com
>
>
> On Mon, Sep 17, 2012 at 4:47 AM, soorajchirag 
> 
> > 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...@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

Re: Creating a new comment, first_line not being used correctly?

2012-09-18 Thread soorajchirag
Thanks. This snippet is definitely useful.

Regards,
Sundeep

On Tuesday, 18 September 2012 00:31:52 UTC+5:30, Steven MacLeod wrote:
>
> 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 
> 
> > 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...@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

Re: Creating a new comment, first_line not being used correctly?

2012-09-17 Thread Steven MacLeod
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 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

Re: Creating a new comment, first_line not being used correctly?

2012-09-17 Thread Christian Hammond
Hi,

The line number is not actually the line of a file, but rather the row of
the side-by-side diff. This is for legacy reasons. Once upon a time, we
didn't have real line number information.

You'd have to figure out which row (1-based) corresponds to the line you
care about and use that number. We should document that better.

Christian

-- 
Christian Hammond - chip...@chipx86.com
Review Board - http://www.reviewboard.org
VMware, Inc. - http://www.vmware.com


On Mon, Sep 17, 2012 at 4:47 AM, soorajchirag 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