I have a precommit hook that works fine when running hg commit in terminal. However when I commit in sourcretree, it seems it isn't executed.
How could I debug why the hook wont fire, or isn't it supported?
the config looks like:
Hmm, we don't specifically turn off any hooks, but does your hook rely on any extensions? For safety, SourceTree disables custom extensions when running to avoid any unexpected behaviour, but you can turn them on again in Preferences > Mercurial. Hooks though, we don't override, and the root ~/.hgrc is still in the configuration stack.
I have tride to add the core extentions and have tried with both emeded mecurial and system. but it dosen't seem to be fired. If i start a terminal from the app and run the same command as the one presented in the commit window (hg commit -y -m "test"). Do you call via a shell or is it done directly through the python package? could it be something with my hook that needs a terminal?
Is there any way for me to get more output from sourcetree to try to debug?
SourceTree just calls 'hg' as a separate process, so except for it not being a full terminal it should behave the same way. You can see more of what's going on by going into Preferences and checking the box 'Always show full output', which will always display the full content of task windows (they normally auto-close on success and hide the detail).
Thank you for the quick response.
I have done some debugging in the python code and verified that the hook gets called.
What I'm curently focusing on is that the python code tries to make command line calls toards pylint and pep8 using subprocess.Popen(...) and mayby it's here things go south.
Thank you for your help, I appologise for not looking at my own code better before posting here.
The issue was that my hook uses binaries in /usr/local/bin, which is in my path when I'm logged in to a terminal. Hovever the scope where sourcetree is executing the hg command /usr/local/bin is not. Once I added full path to the binaries it started to work.
I don't know if it is a security risk, but it would be nice to set some form of shell context for executing commands, in my case bash, and get it to source my .bashrc. This would make sourcetree streamline better with whats happening when I use hg and git in commandline.
Once again, sorry for bloating and thank you for a good product.
Ah yes, it's because the environment for all OS X apps is inherited from launchd and not from your terminal settings. If you want to add to your path in both your terminal and GUI apps in Mac OS X, the easiest way is to edit /etc/paths or add files to /etc/paths.d.
I'm glad you resolved it anyway!
Hi folks, While the full post is over on our blog I'd like to share the dark theme we've got planned for 2019 here directly as well to keep the discussion going. The ...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events