防止推送添加到关闭分支的提交
如何配置 Mercurial 服务器以在指定分支关闭后限制提交?我只希望存储库管理员能够重新打开分支。
https://www.mercurial-scm.org/wiki/PruningDeadBranches 表示已关闭变更集可以通过“变更集的额外字段中的 close=1”来标识。目前尚不清楚如何使用 Mercurial API 读取变更集的额外字段。
How can I configure a Mercurial server to restrict commits to a named branch once it has been closed? I only want the repository administrator to have the ability to reopen the branch.
https://www.mercurial-scm.org/wiki/PruningDeadBranches says that closed changesets can be identified by "close=1 in the changeset's extra field". It's not clear how to read a changeset's extra field using the Mercurial API.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有一个 ACL 扩展与 Mercurial 一起分发。
您应该能够通过拒绝提交除管理员之外的每个分支来指定冻结分支。我不确定指定分支机构是否可以利用此设施。
配置 acl:
There is an ACL extension that is distributed along with Mercurial.
You should be able to specify the frozen branches by denying commit to every one except the administrator. I am not sure if named branches can leverage this facility.
Configuring acls:
服务器无法限制提交,但它可以拒绝接受违反约束的推送。您可以在服务器上放置一个钩子,以拒绝任何在关闭分支上有任何变更集的推送:
您可以像这样安装该钩子:
几乎可以肯定有一种方法可以使用您的 API 中的 python 钩子来完成此操作参考,但 shell hooks 也效果很好。
A server can't restrict commits, but it can refuse to accept pushes that violate constraints. Here's a hook you can put on a server to reject any pushes that have any changesets that are on a closed branch:
You'd install that hook like this:
There's almost certainly a way to do it using in-python hooks with the API you referenced, but shell hooks work out pretty well too.
这是一个进程内挂钩,它应该拒绝关闭分支上的其他变更集。
该钩子可以在 pretxncommit 模式(在本地提交事务期间检查)或 pretxnchangegroup 模式(在从外部存储库添加变更集时检查)运行,并具有以下 hgrc 条目:
不确定此钩子是否适用于 2.2 之前的 Mercurial 版本。
Here's an in-process hook that should reject additional changesets on a closed branch.
The hook can run in pretxncommit mode (checked during a local commit transaction) or pretxnchangegroup mode (checked when changesets added from external repo) with the following hgrc entries:
Not sure if this hook will work with Mercurial versions prior to 2.2.