can't figure out why in-process hook in repo's hgrc doesn't fire when I push via hgweb.cgi
Steve (Gadget) Barnes
gadgetsteve at hotmail.com
Fri Apr 1 05:42:00 UTC 2016
On 31/03/2016 23:07, Alex Mikhail wrote:
> To all,
>
>
>
> I'm running Hg version 3.4.2 and it is running on Windows Server 2008 R2.
>
>
>
> I've recently started using Mercurial and started checking in my current
> projects against it. (I set it up some time ago.) Now I'm trying to
> get the integration between Hg and our ticket system (FogBugz) working.
> Fog Creek provides a python script that picks up any commits whose
> messages have the word FogBugz in them and adds those files from the
> commit to the check-ins of the ticket. (Actually, you add the following
> to the commit message -- FogBugz:12345. This adds the commits' files to
> the ticket 12345.)
>
>
>
> Their instructions say to add the script to the changegroup hook of the
> 'central' repo.
>
> I added it as follows:
>
>
>
> [hooks]
>
> changegroup =
>
> changegroup.fogbugz = python:C:\hgfiles\fogbugz.py:hook
>
>
>
> This way it can pick up any files pushed to the 'central' repo.
>
>
>
> I am using hgweb.cgi with IIS 7.5. If I add script to the hook in
> hgweb.config, the checkins are added but the links are incorrect. This
> is because the links are different for each repo. (There's a config
> parameter specifically for the links in the hg config file.) Ideally,
> the configuration for the hook would reside in each repo's .hg/hgrc file.
>
>
>
> These are the lines added for the links. It would be different for each
> repo.
>
> [web]
>
> baseurl=http://hgweb/hgweb.cgi/hgnotes/
>
>
>
> When I add the script to the changegroup hook on in the repo's hgrc
> file, the hook doesn't run.
>
>
>
> Interestingly enough, when I add the following hook to the repo's hgrc file:
>
> changegroup.test = C:\hgfiles\datetime.bat 1>> C:\hgfiles\out.txt 2>>&1
>
>
>
> It will run.
>
>
>
> I've looked at the IIS logs that execute the mercurial script and all I
> get is details about the HTTP request. I was hoping the CGI script
> might return an error, but no errors are listed there.
>
>
>
> I've also added a trust relationship for my windows user. I placed that
> directive in hgweb.config so hgweb.cgi uses it when it processes a push
> from a remote server. I made sure fogbugz.py and fogbugz.pyc are both
> owned by ZIIVA\amikhail.
>
>
>
> Does anyone have any suggestions on what I can do to troubleshoot the
> issue? What can I do to get some sort of output/error message from the
> in-process hook?
>
>
>
> (On a related note, I did put a ticket in to Fog Creek support a while
> ago, but they where stuck at the same place I was. Neither of us know
> how to get any sort of error message or further output from the
> in-process hook.)
>
>
>
> Here are the config files in question:
>
>
>
> The .hg/hgrc file for the repo:
>
> -------------------------------
>
> [web]
>
> push_ssl=No
>
> allow_push=amikhail
>
> baseurl=http://hgweb/hgweb.cgi/hgnotes/
>
>
>
> [hooks]
>
> changegroup =
>
> changegroup.fogbugz = python:C:\hgfiles\fogbugz.py:hook
>
> changegroup.test = C:\hgfiles\datetime.bat 1>> C:\hgfiles\out.txt 2>>&1
>
>
>
> [fogbugz]
>
> host=http://fogbugz
>
>
>
> The hgweb.config file:
>
> ----------------------
>
> #https://www.mercurial-scm.org/wiki/Trust
>
> [trusted]
>
> users = amikhail
>
>
>
> [paths]
>
> Test1 = C:\hgrepos\test1
>
> Test2 = C:\hgrepos\test2
>
> hgnotes = C:\hgrepos\hgnotes
>
> sfqt = C:\hgrepos\sfqt
>
> ZiivaAdmin2 = C:\hgrepos\ZiivaAdmin2
>
> LongTest = C:\hgrepos\LongTest
>
> WindowsService2 = C:\hgrepos\WindowsService2
>
> Diagrams = C:\hgrepos\Diagrams
>
> ProjectNotes = C:\hgrepos\ProjectNotes
>
>
>
> _______________________________________________
> Mercurial mailing list
> Mercurial at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial
>
One trick that you could try, assuming that you have the python
debugger, pdb, installed would be to use import pdb; pdb.set_trace() in
you python hook, I would suggest just inside the hook script that you
are expecting to be called. This will break into the debugger at that
line and let you see what is going on. The other possibility is that you
might not have python & .py associations correctly set.
Hope that is some help.
--
Steve (Gadget) Barnes
Any opinions in this message are my personal opinions and do not reflect
those of my employer.
More information about the Mercurial
mailing list