关于 Mercurial、.hgignore 文件和 glob 语法
在对 .hgignore 文件使用 glob 语法时,是否可以递归地忽略除一个之外的某些文件和文件夹?
假设您有:
a/
a/b
a/c
a/d
类似的东西:
syntax globe:
a
^a/b
理想情况下应该忽略c和d并保留b。
我知道这已经在其他 SO 问题中讨论过,但似乎它们都使用 regex 模式作为语法。
Is it possible, while using glob syntax for an .hgignore file, to recursively ignore certain files and folders, except one?
Assuming that you have:
a/
a/b
a/c
a/d
Something like:
syntax globe:
a
^a/b
This should ideally ignore c and d and keep b.
I know this has been discussed in other SO questions, but it seems they're all using regex mode for the syntax.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您想忽略除一项之外的所有项,只需添加该一项即可。添加文件会覆盖忽略它,这与 subversion 或 cvs 不同,但非常方便。
If you want to ignore all but one, just add that one. Adding a file overrides ignoring it, which differs from subversion or cvs, but is incredibly handy.
glob 语法在 match.py 中转换为正则表达式。看来这就是您正在寻找的语法:
The glob syntax is transformed to regex in match.py. It seems that this is the syntax you are looking for: