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

This widget could not be displayed.

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

This widget could not be displayed.

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.

This widget could not be displayed.

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
Community showcase
Published Aug 21, 2018 in Bitbucket

Branch Management with Bitbucket

As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team. Some developers are used to performing individual wo...

1,367 views 9 11
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