Stash daily report - Commits info

I would like to create a daily report for each Stash repository that specifies which files each developer has committed to a Stash Git repository.

It might be formatted like:

Committor Timestamp Files (added or modified)

------------- ------------- ------------------------------------

What is the best way to go about acquiring that information from Stash?

I played around with the Stash REST API and was able to get contributor commit data; but, I have not figured out how to get the files that were part of a commit.

Q. Given a commit SHA, how can you find the files contained within a commit via the Stash REST API? Or, some other way?

BTW, to get the commit information, I have done the following:

curl -u user:password -X GET -H "Content-Type: application/json" http://stash.mycompany.com/rest/api/1.0/projects/TES/repos/frm4/commits/bc85af83645141449e34697e5d1c0405d939b6d8 > c:\json-commit.out

But, not sure how to determine the committed files in the JSON output.

Thanks,

Bob

3 answers

Hi Bob,

You can get the files by doing:

curl -u user:password -X GET http://host:/port/rest/api/latest/projects/STASH/repos/stash/changes?since=bc85af83645141449e34697e5d1c0405d939b6d8^&until=bc85af83645141449e34697e5d1c0405d939b6d8&start=0&limit=1000

Note that if you only have the current hash you can append '~' to the end for the since which means 'one commit before' (or ~~ for two etc).

The other alternative would be to write the scripts in Git, by cloning and then doing incremental fetches.

I hope that helps.

Charles

Thanks Charles. That worked.

Any way to get number of commit in a day using Stash REST api ?

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

2,047 views 1 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you