How to get commits in topological order using Azure DevOps REST API - azure-devops-rest-api

I need to get all commits from the master branch in topological order, like git log --topo-order.
I tried with https://learn.microsoft.com/en-us/rest/api/azure/devops/git/commits/get-commits?view=azure-devops-rest-7.1 but commits are sorted in chronological order.
Is there an option to get commits in topological order?

Related

Is there is a way to restrict the number of branches created by the user in bitbucket?

We have notice some repositories have many benches, some of them more than 1000.
Is there is a way to restrict the number of branches created by the user, so we can control the number of branches created?
Bitbucket version: 6.8.2
At this time, this functionality isn't currently available in the product. However, there is an open feature request for this here:
Restrict Git branch creation

Get MR source branch on Push event Gitlab Webhook

Is there a way to get the merge request (particularly the source branch) that caused a particular Push event on the Gitlab Webhook? I want to run a build only once an MR has been merged (hence the push event), but I want to do slightly different things in my Jenkins build based off of the source branch in the MR. Is this doable using a Push event?
I figure one way to do this manually would be to scrape the commit messages from the push event, and parse out any MR commit messages. However, that seems like a very brittle solution.
If it is not doable, could I use the Accepted MR event instead? And if so, is the Accepted event run after the merge happens? Or would I have to do the Merge myself within the job?
According to the Push Events Webhooks Documentation, push events body contains ref field, which is actually the branch to which the push has been performed, i.e the source branch of a merge request (if one has been created for this branch).
If you need more detailed information about the merge request, you may find it useful to consider Merge Requests API. It flexible enough to filter merge requests by source_branch.

TFS 2013 tbl_Branch Status without API

I have a need to get a list of all branches with paths and IsDeleted status. I can do this with the API from a development environment, but I will be unable to use the API in the production environment. A workaround is to query the TFS database for the data I need. I found the branches table (tbl_Branches), but it doesn't have a status column. I am not sure what I need to join on to find the status.
I am looking for the status that is from the property branchObject.Properties.RootItem.IsDeleted if using the API.
Does anyone know what to look at to get the same status for the branch as what the API uses?
Thank you.
The branches are tracked as items. So you need to join "tbl_Version" to get all the versions for the branches. The entries with "DeletionID" > 0 means ther are/were deleted. However, we don't recommend to query TFS Database directly just as Daniel mentioned in the comments. You should avoid this if you have any other workaround.

How can I retrieve all commits from Bitbucket without merge commits?

I found this API for retrieve all commits:
https://bitbucket.es.ad.adp.com/rest/api/1.0/projects/XXXXX/repos/wwwwww/commits/1afdd692dc99eae74c7280306ca97bcb237bbe5f
but the response includes merge commits. I want only original commits. Is there any way to exclude merge commits from the response?
The Bitbucket Server API documentation shows an optional merges parameter on this endpoint:
if present, controls how merge commits should be filtered. Can be either exclude, to exclude merge commits, include, to include both merge commits and non-merge commits or only, to only return merge commits.
I think something like
https://bitbucket.es.ad.adp.com/rest/api/1.0/projects/XXXXX/repos/wwwwww/commits/?merges=exclude
should do the trick.

Crucible API : Query a review by changeset

I was trying to look for a way to query the Crucible API by a specific changeset.
After looking through the API I could not find anything similar.
https://docs.atlassian.com/fisheye-crucible/latest/wadl/crucible.html
Our dev SCM is mercurial and we are trying to find a way to enforce code reviews upon pre-push . The idea is that upon a commit a mercurial hook will auto create a review on crucible and upon pre-push it will check if a review has been completed for this changeset.
Is this possible?
May be it's possible with this REST API by make EyeQL query? You can return "reviews" from the query and to pass csid as param, see more here

Resources