Windows 中的 Mercurial 看不到 .hgignore - 为什么?
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果 .hgignore 文件位于您的用户配置文件目录 (%userprofile%/.hgignore) 中,则编辑您的 Mercurial.ini(也应该位于您的用户配置文件文件夹中)以实现以下内容:
这将导致 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:
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.
另外,请注意这一点:即使 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.
您是否专门指.DS_Store和.Python? ^bin$ 的规则将仅忽略具有该确切字符串的条目。例如,它不会忽略“bin/a.out”。
我唯一能想到的另一件事是,是否有一些全局设置将语法设置为隐藏在某处的 glob(而不是默认的正则表达式)。我不知道有任何这样的事情,如果安装 Mercurial 的官方二进制版本,默认情况下它肯定不会打开。
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.