Hook response in client console/git

anil kumar March 11, 2014

Hi All,

I'm not able to see the output in my git console after doing

git push http://xxxxxxxxxxxxxxxxxxxxxxxxxxxxx.git

I did SDK setup and run it properly.

I got stash console and I able to see the commited messages there.

I enabled the hook in my project repo settings

Everything is working fine but want to see the output after pushing,

Added this print statement at start line in my hook class of public boolean onReceive()

hookResponse.out().println("=============================================== check check check ==========================================");

So can anyone suggest how to get that print statement in client console/git

or where can i find the print statements.

Thanks in advance

Anil

5 answers

1 accepted

0 votes
Answer accepted
anil kumar March 11, 2014

Hi All,

I figured out the problem, i.e., Earlier after installing the atlas sdk nd created plugin and in te hook file i put some print statements and i expected output in client console i.e., on git after doing git push ..

The solution i observed is i need to re run the "atlas-run"

@Balazs Szakmary, thanks for the suggestions.

@Michael Heemskerk, thanks for the debug tip. For now i am not using the ide tool to debug due to other task, but i need to do the debug in eclipse etc.,.I'l come here for the ide issue(s) etc.,

Thanks&Regards

Anil Kumar

Michael Heemskerk
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 11, 2014

Ah yes, you definitely need to redeploy your plugin when you make a change. You don't have to restart your whole server though. As an alternative you can run atlas-cli (in the directory containing the pom.xml of your plugin) and then pi to reinstall the plugin

anil kumar March 12, 2014

Hi Michael,

Thanks for the plugin reinstallation tip,

I need to get and show the merge details of plugin, actually just I created a new question.

https://answers.atlassian.com/questions/272326/how-to-get-the-merge-details-with-plugin

Can you suggest the way on this.

Regards

Anil

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.
March 11, 2014

Hi,

If you are rejecting the commit, you should print the reason like this:

hookResponse.err().println(errorMessage);

and then it will get to the client.

Hope this helps,

Balazs

anil kumar March 11, 2014

Hi Balazs,

I tried with hookResponse.err().println(" some text"), inorder to display something in client console.

But it is not happening.

My doubt is My hoook class is not at all executing and after doing git push "http://xxxxx.git"

To check I used in my hook class like this

public boolean onReceive(RepositoryHookContext context, Collection<RefChange> refChanges, HookResponse hookResponse)

{

return false

}

after this I dded and commited some files and now with git push "http://xxxxx.git" it is simply pushing the contents to the git.

I think my hook is not at all calling...how to check whether my hook class is getting call/working properly..

Regards

Anil

0 votes
Michael Heemskerk
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 11, 2014

Hi,

As a first test to verify that your hook is being called, I'd spin up Stash in debug mode and set a breakpoint in your onReceive method (or alternatively, write something to the Stash log).

Cheers,

Michael

anil kumar March 11, 2014

Hi Michael,

Thanks for the reply. May I know how to do "Stash in debug mode" and setting the breakpoint.

Actually, I configured the SDK and I'm running the plugin. But I didn't integrate into Eclipose IDE.

I think as per you inorder to debug , I need to work with IDE right?..or normally without IDE also can we debug?..

Reards

Anil

Michael Heemskerk
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 11, 2014

you can start up Stash in debug mode by using atlas-debug. Then you need to set up a remote debug target in Eclipse to attach the debugger.

https://developer.atlassian.com/display/DOCS/Creating+a+Remote+Debug+Target

should provide some guidance

0 votes
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.
March 11, 2014

Hi,

Is the hook enabled for the repository where you are pushing? You need to do this one-by-one for all the repos where you want to do this. (Settings/hooks on the web interface.)

Balazs

anil kumar March 11, 2014

Yes, Balazs Szakmary, I already enabled it. And then I'm trying. I didnt get why my print staements are not displaying in git and even I just did return false in public boolean onReceive(){} though push is working with git, But it should not be.

I missed something else. but main thing is why my hook class is not getting called?..

All the commits which I did in git were displayed in stash server.

Can you suggest me why my hook class is not calling.

Just I uploaded the snaps of Repo permission, Hook Settings, Project permissions.

Is there any wrong in it/Did I miss anything...

Anil

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.
March 11, 2014

Hi,

Sorry, I am out of ideas. If it is installed correctly and enabled on the repo you are pushing to, the return false should reject the push.

0 votes
anil kumar March 11, 2014

Hi Balazs,

I tried with hookResponse.err().println(" some text"), inorder to display something in client console.

But it is not happening.

My doubt is My hoook class is not at all executing and after doing git push "http://xxxxx.git"

To check I used in my hook class like this

public boolean onReceive(RepositoryHookContext context, Collection<RefChange> refChanges, HookResponse hookResponse)

{

return false

}

after this I dded and commited some files and now with git push "http://xxxxx.git" it is simply pushing the contents to the git.

I think my hook is not at all calling...how to check whether my hook class is getting call/working properly..

Regards

Anil

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events