Mercurial Hooks are being ignored when using http

Michael Burton mburton at niskala.org
Sat Jun 28 15:19:33 CDT 2008


Hi all,

I have a hook in my main mercurial repository that's intended to  
prevent users from checking in changes that contain leading tabs.   
However, it appears that the hook is not being run when I push to the  
repository using https.  Do I need to do something special to enable  
hooks over http?  I'm using mercurial 1.0.1 on client and server, and  
hgwebdir.cgi.

Here's the contents of the master .hg/hgrc:

> [web]
> contact = blah
> description = blah
> allow_push = *
>
> [hooks]
> pretxnchangegroup.no_tabs = hg dif -r `hg parents --template  
> '{node}'  -r $HG_NODE` -r tip | (! ( egrep -q  '^\+ *      ' && echo  
> 'Please remove all leading tabs from your changes before pushing  
> them.' ) )


If I clone that repository LOCALLY and check in a change containing a  
leading tab, then push that change to the master, the push aborts as  
expected.

> $ hg -v push
> pushing to /home/blah/webapps/hg_repos/repos/djangotest
> searching for changes
> 1 changesets found
> adding changesets
> adding manifests
> adding file changes
> added 1 changesets with 1 changes to 1 files
> running hook pretxnchangegroup.no_tabs: hg dif -r `hg parents -- 
> template '{node}'  -r $HG_NODE` -r tip | (! ( egrep -q  '^\+ *	' &&  
> echo 'Please remove all leading tabs from your changes before  
> pushing them.' ) )
> Please remove all leading tabs from your changes before pushing them.
> transaction abort!
> rollback completed
> abort: pretxnchangegroup.no_tabs hook exited with status 1


However, if I now change my clone's path to use https instead of the  
local filesystem, that very same commit proceeds without any errors.   
It appears that my pretxnchangegroup.no_tabs hook is not being executed.

> $ hg -v push
> pushing to https://blah.com/djangotest
> searching for changes
> 1 changesets found
> adding changesets
> adding manifests
> adding file changes
> added 1 changesets with 1 changes to 1 files



Here's the clone .hg/hgrc:

> [paths]
> #default = /home/blah/webapps/hg_repos/repos/djangotest  # Aborts  
> properly
> default = https://blah.com/djangotest       # FAILS to abort




Perhaps this is a known behavior, but I wasn't able to find anything  
in the book.  The book seems to indicate that hooks will execute over  
http as well as locally.

What do I need to do to get my hook to run over https?  Any help would  
be greatly appreciated.

Thanks,
Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://selenic.com/pipermail/mercurial/attachments/20080628/7f8ea510/attachment.htm 


More information about the Mercurial mailing list