Dee*_*tan 7 version-control configuration mercurial dvcs mercurial-extension
通常,我会通过添加以下内容来启用扩展.hg/hgrc:
[extensions]
hgext.win32text=
[encode]
** = cleverencode:
[decode]
** = cleverdecode:
Run Code Online (Sandbox Code Playgroud)
但是,我希望对此配置进行版本控制,即存储库的一部分,以便为其他任何人(同事,构建计算机)克隆存储库启用它.请注意,不应要求克隆存储库的任何人不需要执行任何操作来启用这些扩展.
它似乎不可能从文档中,但有没有人知道任何可以帮助我在这里的巧妙技巧?
您希望mercurial在克隆repo时自动执行某些操作(更新挂钩或配置).文档说这是不可能的,并给出了一些很好的理由:
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
Run Code Online (Sandbox Code Playgroud)
很明显,mercurial本身不会解决你的问题.你明确表示你只想要解决你的问题,所以答案是:你所要求的是不可能的.
解决问题的唯一方法是,所有用户必须至少运行/安装一次执行所需操作的给定脚本,例如安装正确的挂钩.
如果你想聪明一点:
有点复杂,但这是我能想象到的最接近你的要求:
Mercurial的当前开发版本(将于7月1日作为Mercurial 1.3发布)%include在其配置文件中支持指令.
这意味着你可以要求人们放
%include ../common-hgrc
Run Code Online (Sandbox Code Playgroud)
进入.hg/hgrc.完成后,您可以通过提交更改来有效地控制其Mercurial设置common-hgrc.当他们提取更改时,新设置将生效.
请注意,这很危险:任何可以让您将更改提取到存储库的人现在可以插入任意钩子common-hgrc,您将在下一个Mercurial命令(甚至是"安全"命令行hg status)上执行它们.
| 归档时间: |
|
| 查看次数: |
655 次 |
| 最近记录: |