Review Board can't give you a unified diff for the interdiff because
internally it never actually exists in that format.

You could assemble a diff yourself by downloading the "new" version of each
filediff from both diff revisions, and then running the `diff` command on
that content. There's an endpoint at
/r/<review-request-id>/diff/<diff-revision>/download/<filediff-id>/new/
that will give you the post-patch file content.

Assembling a diff like that would get you something that you could then
give to `patch` to apply if you had the first revision in a working copy.
However, that unified diff may not map 1:1 to what Review Board shows for
the interdiff, because we do a ton of very complex things to try to filter
out changes from other people that are unrelated to the diffs that are
under review.

David

On Wed, Oct 9, 2024 at 3:27 PM Matthew Oldfield <mattaoldfi...@gmail.com>
wrote:

> Hello,
>
> Using Python API Client, it's easy to get the data through a File Diff
> Resource's get_diff_data function.
>
> root = client.get_root()
> files = root.get_files(review_requst_id=review_request_id, diff_revision=2
> )
> diff_data = files[0].get_diff_data()
>
> However, this is always from the perspective of the diff revision compared
> to the original. I have yet to find (if there is a way) to get it from the
> perspective of an interdiff.
>
> I've tried setting diff_revision on methods like get_files to '1-2' to
> mimic the URL used in the frontend to no avail. I don't see methods like
> those take in an interdiff_revision parameter.
>
> I also walked through the get_diff_context return since that is what is
> triggered from the GUI when dragging to see interdiffs and it supports a
> interdiff_revision
>
> diff_context = root.get_diff_context(
>      review_request_id=review_request_id,
>      revision=1,
>      interdiff_revision=2
> )
>
> When it is an interdiff, it returns detail like this for each file:
>                 "interfilediff": {
>                     "id": 84062,
>                     "revision": 2
>                 },
>
> I was hoping I could us this detail to get the associated FileDiffResource
> and call get_diff_data to get the interdiff view data
>
> interdiff_file = root.get_file(
>     review_request_id=review_request_id,
>     diff_revision=interfilediff_revision,
>     filediff_id=interfilediff_id
> )
> interdiff_file.get_diff_data()
>
> but to no avail it is diff2 to orig file.
>
> Could you confirm whether or not this is possible? I suspect it is not as
> interdiffs are quite complicated. However, I wanted to check before I
> potentially go down the path of generating it myself.
>
> Appreciate any insight! Thanks in advance!
>
> Matthew
>
>
> --
> Supercharge your Review Board with Power Pack:
> https://www.reviewboard.org/powerpack/
> Want us to host Review Board for you? Check out RBCommons:
> https://rbcommons.com/
> Happy user? Let us know! https://www.reviewboard.org/users/
> ---
> You received this message because you are subscribed to the Google Groups
> "Review Board Community" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to reviewboard+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/reviewboard/7e047893-0eed-4245-8bd2-7ef0f0c5d595n%40googlegroups.com
> <https://groups.google.com/d/msgid/reviewboard/7e047893-0eed-4245-8bd2-7ef0f0c5d595n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
Supercharge your Review Board with Power Pack: 
https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons: 
https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
--- 
You received this message because you are subscribed to the Google Groups 
"Review Board Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reviewboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/reviewboard/CAFS3VNWZNajncBaonT4GOej5UC-s8JsxiW%2BrDt9d9YQHhNneyg%40mail.gmail.com.

Reply via email to