如何强制 Mercurial 客户端使用特定版本的 Mercurial?
随着 Mercurial 新版本的发布,我们希望以某种方式强制开发人员、设计人员和其他人使用经批准(或更高版本)的 Mercurial 版本。例如,我们目前使用的是 1.8.3 版本,我希望以某种方式自动阻止/拒绝用户使用 1.8.3 之前的任何版本访问我们的存储库,并允许之后的任何版本。 我可以在 hook 中执行此操作吗?
我们在 Windows 和 IIS 上运行服务器。我考虑编写一个 IIS 扩展,它为版本不正确的客户端返回 500 个错误,但客户端在其 HTTP 请求中不发送任何版本信息,只是“mercurial/proto 1.0”,我认为这意味着 Mercurial 的 1.0 版本HTTP 协议。
我想要的可能吗?还有其他方法可以解决这个问题吗?
我们想要这样做是因为 Mercurial 区分大小写。我们 100% 使用不区分大小写的 Windows。这导致我们发生了多次折叠箱碰撞。我们在这些问题上浪费了很多时间。尽管 Mercurial 改进了案例处理,但仍然存在可能引入案例折叠问题的情况。 随着新版本中案例处理的改进,我们希望以某种方式强制我们的用户使用这些版本,这样就不会引入我们必须花时间修复的新问题。
As new versions of Mercurial are released, we want to somehow enforce that developers, designers, and others are using the approved (or later) version of Mercurial. For example, we are currently on version 1.8.3 I'd like someway of automatically preventing/denying users access our repositories using anything before 1.8.3, and allow any verson after. Can I do this in a hook?
We run our server on Windows and IIS. I thought about writing an IIS extension that returned 500 errors for clients not at the right version, but the client doesn't send any version information in its HTTP requests, just "mercurial/proto 1.0", which I assume means version 1.0 of Mercurial's HTTP protocol.
Is what I want possible? Are there any other ways to solve this?
We want to do this because Mercurial is case-sensitive. We are 100% on case-insensitive Windows. This causes us numerous case-folding collisions. We waste hours on them. Although Mercurial has improved its handling of case, it still has situations where case-folding issues can be introduced. As case-handling improvements are made in new versions, we want someway to enforce our users onto those versions so new problems aren't introduced that we have to spend time fixing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您有充分的理由想要强制执行吗? Mercurial 具有自行处理版本功能的内部机制:如果您使用 1.8.3 创建的存储库使用了 1.6 中尚未存在的功能,那么 1.6 客户端将拒绝与此类存储库交互。换句话说,mercurial本身拒绝访问,但不是基于版本号,而是基于实际功能。这样,如果新版本不会破坏兼容性,您可以毫无问题地同时使用这两个版本。
在内部,这是有效的,因为 Mercurial 将所需功能的列表添加到存储库的元信息中,并在尝试使用它执行任何操作之前检查该列表。如果列表包含 Mercurial 尚不知道的功能,它会得出结论,它无法与其进行有意义的交互并拒绝合作。
因此,在我看来,最好的办法就是简单地制定一项政策,要求开发人员使用最新版本,而不是添加额外的技术措施。如果有人尝试使用太旧的版本进行推送,那么他们会收到一条错误消息,如果他们抱怨,您只需将他们指向官方政策即可。
Do you have strong reasons for wanting to enforce this? Mercurial has internal mechanisms that take care of version features themselves: If you create a repository with 1.8.3 that uses features not yet present in, say, 1.6, then an 1.6 client will refuse to interact with such a repository. In other words, mercurial itself denies access, but not based on version number, but based on actual features. This way, if a new release doesn't break compatibility either way, you can use both versions alongside each other without problems.
Internally, this works because mercurial adds a list of required features to the repository's metainformation, and checks this list before attempting to do anything with it. If the list contains a feature mercurial doesn't know about (yet), it concludes that it cannot meaningfully interact with it and refuses to cooperate.
So IMO the best thing to do would be to simply instate a policy that requires developers to use an up-to-date version, but not add additional technical measures. If someone tries to push with a version that's really too old, then they'll receive an error message, and if they complain, you can simply point them at the official policy.
如果您使用的是 Windows,那么如何使用域策略部署 Mercurial 安装程序呢?
If you're on Windows, how about deploying the Mercurial installer using Domain policies somehow?