Can I query JIRA/Stash via the command line for a list of changed files belonging to a task?

One of my project teams is currently evaluating Stash and JIRA and have asked me a couple of questions that I don't have the answer to.
Are any command line tools available that will let them do the following:
1. Query a Jira task to get a list of files changed against the task (with their version/hash).
2. Get a copy of a particular file from stash (it will be from the list create above).
Any assistance to answer these would be awesome.
thanks.

2 answers

1 accepted

0 votes

1. Query a Jira task to get a list of files changed against the task (with their version/hash).

You can use cURL to access Stash's REST api to retrieve the commits that are linked to the JIRA issue. The endpoint you need is /rest/jira/latest/issues/{issueKey}/commits (documentation is here). Each of the returned commits includes a summary of the changes (files added/modified/deleted).

2. Get a copy of a particular file from stash (it will be from the list create above).

From the results of the query described above you can piece together the URL to download a particular version of the file:

http://stash.yourdomain.com/projects/<PROJECTKEY>/repos/<REPOSLUG>/browse/<path/of/affected/file>?at=<commit-hash-of-file>&raw

Note the &raw at the end. This is needed to get the raw contents instead of the HTML marked up version of the file.

0 votes
Timothy Chin Community Champion Jul 25, 2013

For item 1, I don't know what query means exactly but if you integrate JIRA with Stash, you can view the changelist in the issue itself (https://confluence.atlassian.com/display/STASH/JIRA+integration).

And with that, you should be able to go from JIRA to Stash to get the file.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,117 views 13 19
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot