Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting incorrect return from get_commit_diffs() #497

Open
meAbab opened this issue Apr 24, 2024 · 0 comments
Open

Getting incorrect return from get_commit_diffs() #497

meAbab opened this issue Apr 24, 2024 · 0 comments

Comments

@meAbab
Copy link

meAbab commented Apr 24, 2024

I'm trying to get the diff between two commit, therefore using this API as,

            ref_heads = git_client.get_refs(repository_id=REPOSITORY_ID, project=PROJECT_NAME, filter=target_branch)
            master_commit_id = ref_heads.value[0].object_id
            source_commit_id = pull_request.last_merge_source_commit.commit_id

            base_version_descriptor = GitBaseVersionDescriptor(version_type='commit', version=master_commit_id)
            target_version_descriptor = GitTargetVersionDescriptor(version_type='commit', version=source_commit_id)

            commit_diffs = git_client.get_commit_diffs(repository_id=REPOSITORY_ID, project=PROJECT_NAME,
                                                       diff_common_commit=True,
                                                        base_version_descriptor=base_version_descriptor,
                                                        target_version_descriptor=target_version_descriptor)

while print the commit_diffs, having output as,

Diffs Response: {'additional_properties': {}, 'ahead_count': 0, 'all_changes_included': True, 'base_commit': 'b106b44eebeef93d5240f08dca8ceb0124ca4415', 'behind_count': 0, 'change_counts': {}, 'changes': [], 'common_commit': 'b106b44eebeef93d5240f08dca8ceb0124ca4415', 'target_commit': 'b106b44eebeef93d5240f08dca8ceb0124ca4415'}

whereas, using curl to set direct REST request, returns correct output.

"https://dev.azure.com/ORGANIZATION/project/_apis/git/repositories/a21206d3-9bdb-41c4-8b77-56f82360a311e/diffs/commits?baseVersionType=commit&baseVersion=b106b44eebeef93d5240f08dca8ceb0124ca4415&targetVersionType=commit&targetVersion=165c197e54d689e9910eb111b9c14e2516184dd8&api-version=6.0"

What is the correct way to use the get_commit_diff()? Or what I'm doing wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant