mercurial - Mercurial .hgrc 文件中的存储库相对路径

标签 mercurial hgrc

我正在尝试使用 Mercurial 的通用扩展名创建一个共享的 hgrc 文件,以便我的同事可以获得一致的体验并找到有用的工具。但是,启用不随 Mercurial 一起提供的扩展会导致问题。

我的主要存储库的 hgrc 指向一个源代码控制的共享 .hgrc 文件:

\Repo.hg\hgrc

%include ..\tools\hg\dev.hgrc

然后共享的 dev.hgrc 启用我们保持源代码控制的扩展:

\Repo\tools\hg\dev.hgrc
[extensions]
hgshelve=tools\hg\hgshelve\hgshelve.py
fold=tools\hg\hgfold\fold.py

问题是只有在从根 Repo 目录运行 hg 时才能找到这些扩展。从子目录运行它会出现错误:
E:\Repo\src>hg
*** failed to import extension hgshelve from tools\hg\hgshelve\hgshelve.py: [Errno 2] No such file or directory
*** failed to import extension fold from tools\hg\hgfold\fold.py: [Errno 2] No such file or directory

我想引用存储库的根目录,而不依赖于相对路径结构以外的任何内容。

我查看了 manual ,但在那里看不到任何存储库相对路径选项。

最佳答案

这不是您要找的,但是如果您的系统是 puppet、chef 或包控制的,您可以轻松创建一个包,该包将文件放入/etc/mercurial/hgrc.d/中的任何内容都会为所有用户执行每次运行。您可以将扩展名 .py 文件和 hgrc 片段放在那里以启用它们。

关于mercurial - Mercurial .hgrc 文件中的存储库相对路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5706280/

相关文章:

mercurial - 在推送到 hgweb 服务器时创建远程书签

mercurial - 如何使用 Mercurial 保存用户名和密码?

mercurial - 如何自动删除 Mercurial 工作树中的所有 .orig 文件?

Mercurial:如何在changegroup Hook 中获取项目的根文件夹名称?

linux - hgk/hg View 适用于已建立的 repo 协议(protocol),但不适用于新的 repo 协议(protocol)

mercurial - 在 bitbucket 上编辑存储库的 .hgrc

unix - Mercurial:无法在 .hgrc 文件中使用环境变量

python - 推荐为 Python 项目使用 .hgignore 文件吗?

windows - 在 Mercurial 中配置 eol 扩展的问题

mercurial - 在推/拉之前自动触发 Hg 存储库验证,无需编程