搜索“TODO”仅在特定 Mercurial 变更集中发生更改的文件中?
我正在一个已经有很多“TODO”注释的代码库中工作,在推送我的变更集之前,我想确保我没有在其中留下任何 TODO 注释(而不是实际做)它,或将其添加到新功能数据库并删除注释)。
目前我只是在每个评论中使用“TODO:Wilka”,因此很容易搜索。但是,使用 Mercurial 有没有一种方法可以让我仅在变更集集合中已更改的文件中搜索“TODO”?理想情况下,它只会搜索实际已更改的行 - 但即使只是文件也很好。
I'm working in a code base that already has a lot of "TODO" comments, and before I push my changeset(s) I want to make sure I haven't left any of my TODO comments in there (rather than actually doing it, or adding it to the new-feature database and removing the comment).
At the moment I'm just using "TODO: Wilka" in each of the comments, so it's easy to search for. But is there a way with Mercurial I can search for "TODO" only in the files that have changed in a collection of changesets? Ideally, it would only search the lines that have actually changed - but even just the files would be good.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
要搜索一组特定的修订,您可以执行以下操作:
to search a specific set of revisions you could do:
通过管道传输到 grep 的所需修订版本之间的差异,仅使用 grep 编辑搜索修改后的文件
:
正如评论中提到的,这是假设安装了 grep (所以非 Windows 环境)
@谢谢 Tim,如果使用 Windoes,请使用 findstr 而不是 grep
Diff between wanted revisions piped to the grep, only modified files file be searched with the grep
EDIT:
As mentioned in the comments, this is presumes that grep is installed (so non Windows enviroment)
@thanks Tim, if using Windoes, use findstr instead of the grep
自动方式是通过 Mercurial 提交挂钩。 示例可能会有所帮助,checkfiles 扩展名 由 Mercurial 开发人员引用。
根据我的经验,提交钩子是一个混合包,通常可以做你想做的事情,但当你真的想提交一个 TODO 时,它会令人厌烦。 搁置扩展尝试解决此问题,但解决办法可能比问题本身更糟糕。
我还没有探索像 hg com --but-ignore-my-TODO-hook 之类的东西的可能性,这可能很漂亮。
The automated way is via Mercurial commit hooks. The examples may be helpful as might the checkfiles extension referred to by mercurial developers.
In my experience, commit hooks are a mixed bag and often do what you want but are irksome when you really want to commit a TODO. The Shelve extension attempts to work around this, but the cure can be worse than the problem.
I haven't explored the possibility of something like
hg com --but-ignore-my-TODO-hook
which could be nifty.