开发者

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

开发者 https://www.devze.com 2023-01-23 14:47 出处:网络
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.

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=

[h开发者_开发技巧ooks]
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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号