Last active
October 17, 2022 11:02
-
-
Save phun-ky/97bacd9f57e14acdaabecbdd03f13c5c to your computer and use it in GitHub Desktop.
A workaround to get diffs between commits, related to: https://github.com/MicrosoftDocs/vsts-rest-api-specs/issues/20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The url and approach was reverse engineered from the deploy view of VSTS | |
The important part here is the `start_commit`-id and the `stop_commit`-id. | |
*/ | |
const postBody = { | |
context: { | |
properties: { | |
repositoryName: <repository>, | |
projectName: <project_name>, | |
searchCriteria: { | |
gitCommitLookupArguments: null, | |
gitHistoryQueryArguments: { | |
startFromVersion: { | |
versionOptions: 0, | |
versionType: 2, | |
version: <start_commit> | |
}, | |
notInVersion: { versionOptions: 0, versionType: 2, version: <stop_commit> }, | |
order: 0, | |
path: '', | |
historyMode: 0, | |
stopAtAdds: false, | |
author: null, | |
committer: null | |
}, | |
gitArtifactsQueryArguments: null, | |
gitGraphQueryArguments: { | |
fetchGraph: false, | |
emptyLineLengthLimit: 20, | |
emptyLineLengthMultiplier: false, | |
order: 0 | |
} | |
} | |
} | |
}, | |
contributionIds: ['ms.vss-code-web.git-history-view-commits-data-provider'] | |
}; | |
fetch({ | |
uri: 'https://<account>.visualstudio.com/_apis/Contribution/dataProviders/query/project/<project>?api-version=5.0-preview.1', | |
method: 'POST', | |
body: postBody, | |
json: true | |
}).auth(<username>, <personal_access_token>) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How did you come up with such a solution?!!!
BTW, which pkg are "fetch" and "auth" in?
Which API is applied?