版本控制的扩展配置在Mercurial [英] Version-controlled extension configuration in Mercurial

查看:203
本文介绍了版本控制的扩展配置在Mercurial的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常,我通过在 .hg / hgrc 中添加以下内容来启用扩展:

Normally, I would enable extensions by adding the following to .hg/hgrc:

[extensions]
hgext.win32text=
[encode]
** = cleverencode:
[decode]
** = cleverdecode:

但是,我想要将此配置进行版本化,即部分库,任何人(同事,构建机器)克隆存储库。请注意,任何克隆存储库的人都不应该要求任何任何来启用这些扩展。

However, I want this configuration to be versioned, i.e. part of the repository, so that it is enabled for anyone else (coworkers, build machines) cloning the repository. Note that whomsoever clones the repository should not be required to do anything to enable these extensions.

看起来不可能从文档,但是有没有人知道任何可以帮助我的巧妙的技巧?

It appears it is not possible from the documentation, but does anyone know any neat tricks that can help me here?

推荐答案

您希望mercurial在克隆repo时自动执行某些操作(更新钩子或配置)。 文档说这是不可能的,并给出一些非常好的原因:

You want mercurial to do something automatically when you clone a repo (update the hooks or config). Documentation says it is not possible and gives some very good reasons:

Hooks do not propagate

In Mercurial, hooks are not revision controlled, and do not propagate when you clone,
or pull from, a repository. The reason for this is simple: a hook is a completely    
arbitrary piece of executable code. It runs under your user identity, with your 
privilege level, on your machine. No comments

It would be extremely reckless for any distributed revision control system to 
implement revision-controlled hooks, as this would offer an easily exploitable way to 
subvert the accounts of users of the revision control system. No comments

很清楚,mercurial本身不能解决你的问题。你清楚地说,你想要什么,但只有mercurial解决你的问题,所以答案是:你要求是不可能的。

So clearly, mercurial itself won't solve your problem. You clearly state that you want nothing but mercurial to solve your problem, so the answer is: what you are asking is not possible.

解决你的问题的唯一方法是所有的用户必须至少运行/安装一个给定的脚本,执行你想要的操作,如安装正确的钩子。

The only way to solve your problem is that all your users will have to run/install at least once a given script that perform the actions you want, something like installing the right hooks.

如果你想聪明的:


  • 创建一个一次性脚本运行,将安装一个钩子将正确的配置复制到.hg或

  • 请确保该挂接安装后可以更新脚本以将配置更新分发给用户

  • 使挂钩添加一些特殊标记

有点复杂,但这是最接近我可以想象到你的要求:

A bit complicated, but that's the closest I can imagine to your requirements:


  • 用户运行脚本一次,他们忘记了

  • 您可以确保如果没有运行它,它们不能提交到您的中央仓库

这篇关于版本控制的扩展配置在Mercurial的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆