jfrobishow
jfrobishow

Reputation: 2895

Mercurial - block access to a branch using ACL extension on Windows

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.

Upvotes: 3

Views: 1373

Answers (1)

Ry4an Brase
Ry4an Brase

Reputation: 78340

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.

Upvotes: 2

Related Questions