如何使具有特定扩展名的文件自动添加到提交中?

发布于 2024-10-05 05:34:35 字数 119 浏览 0 评论 0原文

我试图弄清楚如何自动将特定扩展名(例如 *.tex)的所有文件添加到提交对话框(该复选框应该已经被选中!我不想每次都搜索新文件)

我尝试将 *.tex 添加到自动提交列表(=逗号分隔列表),但这没有任何作用。

I'm trying to figure out how to automatically add all files of a certain extension (for example *.tex) to the commit dialogue (the checkbox should already be checked! I don't want to search for the new files every single time)

I tried adding *.tex to the auto-commit list (=comma separated list) but that doesn't do anything.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

暗地喜欢 2024-10-12 05:34:35

Mercurial 有所谓的钩子来自动处理某些事件。另请参阅 hgrc 文档有关 Hooks 的 Mercurial wiki 页面

您的任务可以通过在存储库的 hgrc 文件中定义的 pre-commit 挂钩来完成:

[hooks]
pre-commit = hg add -I "*.tex"

在提交之前,此挂钩会自动添加所有尚未跟踪的 tex< /em> 存储库当前工作目录的根目录中的文件。调整 -I 选项的值或添加更多 -I 选项以指定要自动添加的更复杂的文件模式。

注意:我不使用 TortoiseHG,因此我无法判断此挂钩是否会导致任何复选框被预选。不管怎样,如果你使用 TortoiseHG,它也应该可以工作。

Mercurial has so called hooks to do stuff automatically on certain events. See also the hgrc documentation and the Mercurial wiki page on Hooks.

Your task can be done with a pre-commit hook, defined in your repository's hgrc file:

[hooks]
pre-commit = hg add -I "*.tex"

Before a commit, this hook automatically adds all not yet tracked tex files in the root of the repository's current working directory. Adjust the value of the -I option or add more -I options to specify more complex patterns of files to add automatically.

Note: I don't use TortoiseHG, so I cannot say if this hook causes any checkboxes to be pre-selected. Anyway, it should also work if you commit with TortoiseHG.

太阳哥哥 2024-10-12 05:34:35

在 hg 作为控制台应用程序中,这个非常简单的解决方案也有效:

hg add "*.tex"

In hg as console application this very simple solution works, too:

hg add "*.tex"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文