忽略 Mercurial 中的文件夹
警告: 我尝试了此处列出的所有可能性: 我怎样才能忽略Mercurial 中文件夹下的所有内容。
没有一个像我希望的那样工作。
我想忽略文件夹 test
下的所有内容。 但不忽略 srcProject\test\TestManager
我尝试
syntax: glob
test/**
它会忽略 test
和 srcProject\test\TestManager
与:
syntax: regexp
^/test/
这是同一件事。
另外:
syntax: regexp
test\\*
我已经在 Windows 中安装了 TortoiseHG 0.4rc2 和 Mercurial-626cb86a6523+tortoisehg、Python-2.5.1、PyGTK-2.10.6、GTK-2.10.11
Caveat:
I try all the posibilities listed here: How can I ignore everything under a folder in Mercurial.
None works as I hope.
I want to ignore every thing under the folder test
. But not ignore srcProject\test\TestManager
I try
syntax: glob
test/**
And it ignores test
and srcProject\test\TestManager
With:
syntax: regexp
^/test/
It's the same thing.
Also with:
syntax: regexp
test\\*
I have install TortoiseHG 0.4rc2 with Mercurial-626cb86a6523+tortoisehg, Python-2.5.1, PyGTK-2.10.6, GTK-2.10.11 in Windows
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在正则表达式版本中尝试在插入符号后不加斜杠。
这是一个测试:
请注意,ignoreme 没有显示,而 dont-ignore 则显示。
Try it without the slash after the caret in the regexp version.
Here's a test:
Notice that ignoreme isn't showing up and dont-ignore is.
这两种情况都对我有用(在 Linux 和 Windows 上):
或者
但是,在我将 .hgignore 文件的链接添加到我的存储库中的 .hgrc 文件之前:
还值得一提的是,mercurial 会忽略它不是的文件当前正在跟踪,这是在您将其配置为忽略它们之前添加的。 因此,不要因为 hg status 说某些文件是 M(已修改)或 ! (丢失)在您刚刚添加到忽略列表的文件夹中!
Both cases worked for me (on linux and windows):
or
However, it wasn't before I added a link to .hgignore file to .hgrc file in my repo:
Also worth mentioning that mercurial ignores files that it is not currently tracking, which are those added before you configured it to ignore them. So, don't be put off by hg status saying some filed are M (modified) or ! (missing) in the folders that you have just added to the ignore list!
您可以使用零宽度负向前查找和向后查找断言来指定仅当
test
前面没有srcProject
且后面没有时才忽略它>TestManager
:Mercurial 使用 Python 正则表达式,因此您可以在 Python 文档中找到有关零宽度断言的更多信息:https://docs.python.org/library/re.html#regular-expression-syntax
You can use zero-width negative look-ahead and look-behind assertions to specify that you want to ignore
test
only when it's not preceded bysrcProject
and not followed byTestManager
:Mercurial uses Python regular expressions, so you can find more info on zero-width assertions in the Python docs: https://docs.python.org/library/re.html#regular-expression-syntax
在存储库的根目录下创建 .hgignore 文件
现在在文件中添加以下内容。
这将从存储库中删除 bin 目录和所有 *.DS_Store 文件
Create .hgignore file under root directory of the repository
Now add the following contents in the file .
This will remove the bin directory and all the *.DS_Store files from the repository