Mercurial - 在 Windows 上使用 ACL 扩展阻止对分支的访问

发布于 2024-09-30 15:51:55 字数 688 浏览 4 评论 0 原文

我试图在 Windows 上使用 ACL 拒绝每个人提交对分支的访问权限,但似乎不太明白。根据我发现的小文档,这应该可行。

我的 hgrc 文件:

[extensions]
hgext.acl=

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

[acl]
sources = commit

[acl.deny.branches] 
default = *

这是否应该拒绝每个人对默认分支的提交访问权限?我尝试过,现在每次提交,无论分支给出:

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

让我认为我配置错误,但这几乎正是他们在 AclExtension 文档

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

耶耶耶 2024-10-07 15:51:55

这是 acl.py 中的相关代码:

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

我认为在您的钩子名称中的“.acl”被删除后进行检查,但也许在您的 Mercurial 版本中(什么版本?)它不是?

尝试将 [hooks] 部分更改为:

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

仅当您有多个相同类型的钩子时才需要 .acl

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文