On Fri, Oct 14, 2011 at 10:35 PM, Christian Hammond <chip...@chipx86.com>wrote:

> Hi Robert,
>
> Sorry I didn't get to this sooner, but you're correct. It's a virtual line
> number that is based on the generated diff using our specific algorithm. We
> use virtual line numbers rather than real numbers because real numbers
> wouldn't necessarily make sense depending on how you generate the diff
> (different algorithms may decide to insert lines differently, or fall back
> on replaces more, or whatever).
>

Hi Christian,

Thanks for confirming the general algorithm. I suspected I would be in for a
fun ride :-)

For my purposes I need to get 1-to-1 mapping with the line numbers shown on
ReviewBoard . I guide myself after the unified diff algorithm as generated
by diff from diffutils . Is that a safe path to take or does RB perform this
mapping differently?


> This was all done pre-API, and it might make sense to bundle in the real
> line numbers for informational purposes going forward, but it's unlikely to
> be high on the TODO list for me.
>

Right. If I will have good results with my own mapping, it will not be an
issue for me.


>
> What you can do is take our generated diff from the API and use that to
> reverse-map the virtual line numbers back to the real ones.
>

That's what I started on. To ask a related question, does RB preserve the
exact patch submitted, e.g. for Subversion, or does it serve an equivalent
patch, possibly adjusted for its internal purposes?


>
> (I'm assuming the last line number in your example below should be 5 and
> not 4).
>

That's correct, it was a typo.


>
> Out of curiosity, what are you working on where you're needing this info?
>

I have been working for some time on a fork of the Reviewboard Mylyn
connector for Eclipse ( https://github.com/rombert/ereviewboard/ )  started
by Markus Knittig .

The next version will have side-by-side display of changes in Eclipse's
compare editor . I am going to add inline display of diff comments to that
as well, and I need precise line mapping information.

Thanks,

Robert


>
> Christian
>
> --
> Christian Hammond - chip...@chipx86.com
> Review Board - http://www.reviewboard.org
> VMware, Inc. - http://www.vmware.com
>
>
>
> On Fri, Oct 14, 2011 at 2:59 AM, Robert Munteanu <
> robert.munte...@gmail.com> wrote:
>
>>  I've tried to understand how this mapping is perfomed and came up with
>> the following description/example. Can anyone confirm that I got it right?
>>
>> Thanks.
>>
>> ReviewBoard diff comments are mapped to the virtual diff table which is
>> shown in the web interface, not to a location in the old or new file.
>>
>> Take for instance the following side-by-side comparison:
>>
>>
>>  1: This is the first line     This is the first line
>>  2: This is the second line
>>  3:                            This is the third line
>>  4: This is the fourth line
>>  4: This is the fifth line     This is the fifth line ( adjusted )
>>
>>
>> The line mappings are the following:
>> Unified diff Old fileNew file1112 2N/A3N/A243 N/A543
>>
>> --
>> 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
>



-- 
Sent from my (old) computer

-- 
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