Mercurial:添加文件时发出警告,否则会被忽略?
如何让 Mercurial 在添加本来会被忽略的文件之前发出警告?
例如,类似:
$ hg add foo.o
warning: adding ignored file foo.o
似乎有一个补丁已提交到邮件列表: https://www.mercurial-scm.org/pipermail/mercurial-devel/2008-February/004993.html
但我找不到任何进一步的参考。
How can ask Mercurial to warn me before I add files which would otherwise be ignored?
For example, something like:
$ hg add foo.o
warning: adding ignored file foo.o
There seems to have been a patch submitted to the mailing list: https://www.mercurial-scm.org/pipermail/mercurial-devel/2008-February/004993.html
But I can't find any further references to it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用
hg addremove
。它不会添加被忽略的文件。摘自 addremove 文档
Use
hg addremove
. It will not add ignored files.Extract from addremove documentation
这是一种黑客解决方法,只有您想要的一半,但您可以替换
为
“添加所有内容,但前提是它不被忽略并且它与
-I”。
一个例子:
所以你可以看到“this”没有被添加,仍然处于忽略状态。当然,这不是警告,而是拒绝。
It's sort of a hacky workaround and only half what you want, but you could replace
with
That says "add everything but only if it's not ignored and it matches the pattern after
-I
".An example:
So you can see that "this" wasn't added and is still in ignored state. Of course, that's not a warning, it's a refusal.
这对添加没有多大帮助,但是您可以在提交期间使用 a 来捕获它
pretxncommit 钩子。
This won't help much on add, but you could catch it during commit by using a
pretxncommit hook.