Stash - which plugin module is used for commit history

I am still new to Stash, I want to create a plugin to view commit history and the info of each file that stored on repository,  can anyone tell me which plugin module is best to get start? I used repository hook module before, but it seems like i can't get info of the file with it.


thanks in advance!

3 answers

1 accepted

So the code below should give you a list of all the repositories in stash, and for each repository download it and run the git log command to get a list of all the commits. 



public static void main(String[] args) throws MalformedURLException  {
        HttpClientConfig clientConfig = new HttpClientConfig(new URL(url), user, pwd);
        HttpClientStashClientFactory factory = new HttpClientStashClientFactoryImpl();
        if (factory.getStashClient(clientConfig).getAccessibleProjects(0, 10) != null)
        	factory.getStashClient(clientConfig).getAccessibleProjects(0, 10).getValues().forEach((Project project) -> 
				factory.getStashClient(clientConfig).getRepositories(project.getKey(), null, 0, 0).getValues().forEach((Repository repo) -> 


			Now that you have the url, down each repository, and run 

			 "git --no-pager log --oneline"
 			Parse the result into something and go through the data. 

Saying that, there might actually be a class that deals with the commit history in the Atlassian API - this I am not sure of, but the above solution also works (might take a while to do the first run)

If this helps, can I get a upvote, trying to get 3 points so I don't have the 1msg per 24hour limitation

all the commit history stuff is held in the git repository itself. 


To get it, have your plugin call "git --no-pager log --oneline" and parse the results however you want.

thanks Peter, do you mean that using the classes in com.stash.scm.git? I had tried it, but i couldnt import the all .jar in com.stash.scm.git, I am using maven to import the all .jar of stash (adding maven repository and dependencies to pom.xml).

could you tell me what other classes I can used in my plugin to call git commands? thanks!

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