3

I am trying to deny everyone commit access to a branch using ACL on Windows but can't quite seem to figure it out. According to the little documentation I've found this should work.

My hgrc file:

[extensions]
hgext.acl=

[hooks]
pretxncommit.acl = python:hgext.acl.hook

[acl]
sources = commit

[acl.deny.branches] 
default = *

Shouldn't this deny everyone commit access to the default branch? I tried and now every commit, no matter the branch give:

error: pretxncommit.acl hook failed: config error - hook type "pretxncommit" can
not stop incoming changesets
transaction abort!
rollback completed
abort: config error - hook type "pretxncommit" cannot stop incoming changesets

Leads me to think I configured it wrong, but it's pretty much exactly how they do it in the AclExtension documentation.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
jfrobishow
  • 2,897
  • 2
  • 27
  • 42
  • 2
    Your `hgrc` works as expected for me on WinXP and Mercurial 1.7 (I just upgraded!). What version of Mercurial do you have? – Niall C. Nov 03 '10 at 20:03
  • @Niall C. I was under 1.5.1, the one that came bundled with TortoiseHg when I installed a while back. I upgraded to 1.7 and it worked fine. Wasn't clear I needed to upgrade from the doc. Thanks! – jfrobishow Nov 03 '10 at 20:11

1 Answers1

2

Here's the relevant code from acl.py:

if hooktype not in ['pretxnchangegroup', 'pretxncommit']:
    raise util.Abort(_('config error - hook type "%s" cannot stop '
                       'incoming changesets nor commits') % hooktype)

Which I would think checks after the ".acl" from your hook name is removed, but perhaps in your version of mercurial (what version?) it isn't?

Try changing your [hooks] section to just this:

[hooks]
pretxncommit = python:hgext.acl.hook

the .acl is only necessary when you have multiple hooks of the same type.

Ry4an Brase
  • 78,112
  • 7
  • 148
  • 169