Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Getting file path and an ObjectID in a pre-receive hook

Jordan Salina June 9, 2014

I'm trying to fill in streamFile on a pre-receive hook. I can't figure out how to get a changesetID and a path for the file being pushed to the repository. How do I get those?

4 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Jordan Salina June 11, 2014

I ended up using commitService.streamChanges([parameters]). From there you can grab the file path (change.getPath()) for each change. As for the changesetID I decided to use the refHash isntead which is also valid. You can get that by doing refChange.getFromHash().

1 vote
anil kumar June 9, 2014

This will help,

https://answers.atlassian.com/questions/171295/stash-pre-receive-hook-plugin-accessing-committed-contents

Normally inorder to get the file path

commitService#onStreamChanges() will gives us to get file path.

go through the abbove link and you will get the sample code in sub links.

Check the latest discussion of mine

Regards

Anil Kumar R

1 vote
Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 9, 2014

The code sample here should get you as far as the changesets. I am not sure how to get the files, but I suspect it is probably somewhere in CommitService.

0 votes
bharath thippireddy January 18, 2015

Can you please post your solution here.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events