microsoft / microsoft/azure-devops-python-api
Getting incorrect return from get_commit_diffs()
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 684
- Forks
- 218
- Avg merge
- 8d 10h
- Merged PRs (30d)
- 1
Description
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?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the get_commit_diffs() entry point and compare the Python arguments with the REST request shown in the issue, especially the base and target commit descriptors. Reproduce the call and verify whether the returned base_commit, target_commit, and changes match the direct REST response; done means the Python API returns the expected diff.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, python
- Domain
- api, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100