You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to use GitClientBase.get_commit_diffs method (v4_0) #70
I specify repository_id, project_id and IDs for two commits from the repository. But the method returns something different which looks like a recent commit in the repo.
Please notice both baseVersionType=commit and targetVersionType=commit query parameters are required since both baseVersion and targetVersion points to commitIds.
You won't have permission to access my personal vsts account. But you can try it on your own vsts account by following the same url format and it should work.
BTW, commit diff rest api should fail with meaningful error message while neither baseVersion and targetVersion query parameters are provided instead of returning the "empty" diff from your default branch's tip commit. We're working on a fix on that as well.
WladdGorshenin I have reopened the issue. Can you repost your new question, with example request/response so we can investigate? Be sure to scrub any personal data.
By the way, what would be the best recipe to reproduce 'git diff commitA commitB -- file' results with VSTS? My goal is for each tuple (commit, overlapping_commit, file) find out the number of lines in the file touched by both commits?
WladdGorshenin I'm glad the api is working for you now. I am going to go ahead close this bug. Since your last question is related to the api itself and not specifically the python library, the best place to ask your question is at the following url. Please submit your question there, and we can make sure someone looks at it.
Activity
tedchamb commentedon May 18, 2018
The python api is a thin wrapper around our REST APIs. Take a look at our REST documentation here on this particular API which has a few examples.
https://docs.microsoft.com/en-us/rest/api/vsts/git/diffs/get?view=vsts-rest-4.1
If this doesn't clear things up, enable logging by doing the following:
`import logging
logging.basicConfig(level=logging.DEBUG)`
Then send us the request/response of the command, after scrubbing any personal data.
WladdGorshenin commentedon May 30, 2018
Hi Ted,
I'm coming back to the question. Here is the scrubbed debug information:
and scrubbed response:
It seems something is wrong with VSTS API.
jianges commentedon May 30, 2018
Hi,
I'm sorry that our rest api doc isn't super clear. While you specify a commit as a version descriptor, you would also need to specify the version type. e.g.:
https://jianges.visualstudio.com/myProject/_apis/git/repositories/718efd9e-6ca0-42de-9df1-a35035c14b4c/diffs/commits?baseVersionType=commit&baseVersion=4081f4d0a3219d4d9bd8ee6cf444f16320d4e573&targetVersionType=commit&targetVersion=46f39e2e222eeb5104351f149902aec2137b2d8d&api-version=4.1-preview
Please notice both baseVersionType=commit and targetVersionType=commit query parameters are required since both baseVersion and targetVersion points to commitIds.
Thanks,
Jiange
tedchamb commentedon May 30, 2018
The issue has been identified and we are working on a fix.
WladdGorshenin commentedon May 31, 2018
Hi JIANGE SUN (@jianges), thank you for the note. I tried your link but got 401 error. Probably there is some authorization issue.
jianges commentedon May 31, 2018
You won't have permission to access my personal vsts account. But you can try it on your own vsts account by following the same url format and it should work.
BTW, commit diff rest api should fail with meaningful error message while neither baseVersion and targetVersion query parameters are provided instead of returning the "empty" diff from your default branch's tip commit. We're working on a fix on that as well.
tedchamb commentedon May 31, 2018
This will be fixed with #73
tedchamb commentedon May 31, 2018
Version 0.1.7 has been published to pypi and has the fix. Thanks for reporting this issue.
https://github.com/Microsoft/vsts-python-api/releases/tag/0.1.7
tedchamb commentedon Jun 1, 2018
WladdGorshenin I have reopened the issue. Can you repost your new question, with example request/response so we can investigate? Be sure to scrub any personal data.
jianges commentedon Jun 1, 2018
WladdGorshenin I just tried both $skip and $top=2 query parameters and verified they work as expected. The Ahead/Behind counts are the commit counts between base and target commits and they won't be impacted by the bsvskip (@Skip) and Top (@top). bsvskip (@Skip) and Top (@top) will control the list of items returned from the api.
You won't be able to access this URL but I'm including it here so you can try out something similar on your own account:
https://jianges.visualstudio.com/myProject/_apis/git/repositories/myRepo/diffs/commits?$skip=1&$top=2&baseVersionType=commit&baseVersion=4081f4d0a3219d4d9bd8ee6cf444f16320d4e573&targetVersionType=commit&targetVersion=46f39e2e222eeb5104351f149902aec2137b2d8d&api-version=4.1-preview
WladdGorshenin commentedon Jun 1, 2018
Hi guys, sorry for the false alarm. Everything works as expected.
WladdGorshenin commentedon Jun 1, 2018
By the way, what would be the best recipe to reproduce 'git diff commitA commitB -- file' results with VSTS? My goal is for each tuple (commit, overlapping_commit, file) find out the number of lines in the file touched by both commits?
tedchamb commentedon Jun 1, 2018
WladdGorshenin I'm glad the api is working for you now. I am going to go ahead close this bug. Since your last question is related to the api itself and not specifically the python library, the best place to ask your question is at the following url. Please submit your question there, and we can make sure someone looks at it.
https://docs.microsoft.com/en-us/rest/api/vsts/git/diffs?view=vsts-rest-4.1