> ## Documentation Index
> Fetch the complete documentation index at: https://docs.diversion.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Get changes for a review

> Get the correct ancestor and compare commits for a review.
This endpoint uses the merge commit's parent (if merged) to find the original divergence point,
solving the issue where squash merges make find_common_ancestor return the feature tip.




## OpenAPI

````yaml get /repos/{repo_id}/reviews/{review_id}/changes
openapi: 3.0.3
info:
  title: Diversion Core API
  description: >-
    Definition of the Core API used to access low-level functionality of
    Diversion
  version: 0.2.0
servers:
  - url: https://api.diversion.dev/v0
    description: Base endpoint
security: []
paths:
  /repos/{repo_id}/reviews/{review_id}/changes:
    parameters:
      - $ref: '#/components/parameters/RepoParam'
      - in: path
        name: review_id
        required: true
        description: The review ID
        schema:
          type: string
          example: dv.review.12345
          minLength: 3
          maxLength: 128
    get:
      tags:
        - Reviews
      summary: Get changes for a review
      description: >
        Get the correct ancestor and compare commits for a review.

        This endpoint uses the merge commit's parent (if merged) to find the
        original divergence point,

        solving the issue where squash merges make find_common_ancestor return
        the feature tip.
      operationId: src.handlersv2.review.get_review_changes
      responses:
        '200':
          description: Returns the ancestor and compare commits for the merged review
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MergeRequestResponse'
        '400':
          description: Review has not been merged yet
          content:
            application/json:
              schema:
                $ref: '#/components/responses/BadRequest'
        '404':
          description: Review not found
          content:
            application/json:
              schema:
                $ref: '#/components/responses/NotFound'
      security:
        - OAuth2:
            - coreapi/write
components:
  parameters:
    RepoParam:
      in: path
      name: repo_id
      required: true
      schema:
        type: string
        example: example_id
        minLength: 3
        maxLength: 128
      description: >-
        The repo ID of the repository. Repo _name_ can be used instead of the
        ID, but usage of ID for permanent linking and API requests is preferred.
  schemas:
    MergeRequestResponse:
      type: object
      properties:
        url:
          type: string
        other_commit_id:
          type: string
        ancestor_commit_id:
          type: string
      required:
        - url
        - other_commit_id
        - ancestor_commit_id
    Error:
      type: object
      properties:
        status:
          type: integer
          description: HTTP status code
        detail:
          type: string
        title:
          type: string
        type:
          type: string
      required:
        - status
        - detail
  responses:
    BadRequest:
      description: The request does not meet the required conditions
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: The specified resource was not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    OAuth2:
      type: oauth2
      x-tokenInfoFunc: src.token_info.token_auth
      description: This API uses OAuth 2 with the implicit grant flow
      flows:
        implicit:
          authorizationUrl: https://auth.diversion.dev/oauth2/authorize
          scopes:
            coreapi/read: Operations with no possible side-effects
            coreapi/write: Modifying operations
            coreapi/admin: >-
              Organizational operations like adding a repo or changing repo
              properties

````