Windows 中的 Mercurial 看不到 .hgignore - 为什么?

发布于 2024-08-12 15:06:00 字数 402 浏览 5 评论 0原文

Windows 无法获取我的 .hgignore 文件。我从命令行运行 Mercurial,“hg status”显示被忽略的目录中的大量文件。

.hgignore 文件如下所示(文件开头或每行开头没有空格)。我已将其放在存储库的根目录中。

\.pyc$
\.pyo$
\.DS_Store
\.Python
\.installed.cfg
^bin$
^build$
^develop-eggs$
^eggs$
^include$
^lib$
^parts$
^pip-log.txt$
^web/localsettings.py$

我尝试过以 ANSI 和 UTF-8 格式保存文件,但似乎没有什么区别。

我知道该文件在 Linux 上运行正常,Windows 中的路径有什么不同吗?

Windows fails to pick up my .hgignore file. I'm running Mercurial from the command line, and "hg status" shows lots of files in the ignored directories.

The .hgignore file looks like this (there's no whitespace at the start of the file, or at the start of each line). I've put it in the root directory of the repository.

\.pyc$
\.pyo$
\.DS_Store
\.Python
\.installed.cfg
^bin$
^build$
^develop-eggs$
^eggs$
^include$
^lib$
^parts$
^pip-log.txt$
^web/localsettings.py$

I've tried saving the file in ANSI and UTF-8, and it doesn't seem to make a difference.

I know the file is working OK on Linux, is there anything different about the paths in Windows?

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

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

发布评论

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

评论(4

如何视而不见 2024-08-19 15:06:00

如果 .hgignore 文件位于您的用户配置文件目录 (%userprofile%/.hgignore) 中,则编辑您的 Mercurial.ini(也应该位于您的用户配置文件文件夹中)以实现以下内容:

[ui]
ignore = %USERPROFILE%/.hgignore

这将导致 hg 识别并使用您的.hgignore 文件。用户配置文件目录中的 .hgignore 文件将影响所有存储库的 hg 行为。如果您想要特定的每个存储库设置,您应该能够将 .hgignore 文件放在每个存储库的根目录中。

If the .hgignore file is in your user profile directory (%userprofile%/.hgignore), then edit your mercurial.ini (which should also be in your user profile folder) to have this:

[ui]
ignore = %USERPROFILE%/.hgignore

That will cause hg to recognize and use your .hgignore file. The .hgignore file in your user profile directory will affect hg's behavior for all repositories. If you want to have specific per-repository settings, you should be able to put .hgignore files in the root of each repository.

指尖凝香 2024-08-19 15:06:00

另外,请注意这一点:即使 Mercurial 拾取新的 .hginore 文件,它也不一定会忽略所有指定的文件!之前添加到存储库的任何文件都不会被忽略,除非您明确地将其从存储库中删除。

Also, be aware of this: Even if Mercurial is picking up your new .hginore file, it won't necessarily ignore all the specified files! Any file that had previously been added to the repository will NOT be ignored until you explicitly remove it from the repository.

木緿 2024-08-19 15:06:00
  • 首先,.hgignore 文件必须位于存储库的根目录中
  • 然后,您必须在 .hgignore 文件的第一行指定使用的语法(在您的情况下为 regexp):

语法:正则表达式

  • First, the .hgignore file must be in the root of your repository
  • Then, you must specify the used syntax at the first line of your .hgignore file (in your case, regexp):

syntax: regexp

或十年 2024-08-19 15:06:00

“hg status”显示被忽略的目录中存在大量文件

您是否专门指.DS_Store和.Python? ^bin$ 的规则将仅忽略具有该确切字符串的条目。例如,它不会忽略“bin/a.out”。

我唯一能想到的另一件事是,是否有一些全局设置将语法设置为隐藏在某处的 glob(而不是默认的正则表达式)。我不知道有任何这样的事情,如果安装 Mercurial 的官方二进制版本,默认情况下它肯定不会打开。

"hg status" shows lots of files in the ignored directories

Are you referring to .DS_Store and .Python exclusively? The rule for ^bin$ will only ignore entries with that exact string. It will not, for example, ignore "bin/a.out".

The only other thing I could think of is if there is some global setting that sets the syntax to glob (as opposed to the default of regex) hiding somewhere. I'm not aware of any such thing, and it certainly isn't on by default if installing an official binary version of Mercurial.

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