[英]Is there a way to search ALL mercurial commits for a specific string?
在一种情况下,我们知道存储库中某个特定的商品提交中使用的关键字。 但是我们不知道其中包含什么提交。显然,我可以遍历每个提交的文件并最终找到关键字以及如何使用该关键字,但这将是很多繁琐的工作。
有没有办法在存储库中所有已提交的代码中搜索字符串?
hg grep
正是这样做的。
hg grep [OPTION]... PATTERN [FILE]...
search for a pattern in specified files and revisions
Search revisions of files for a regular expression.
This command behaves differently than Unix grep. It only accepts
Python/Perl regexps. It searches repository history, not the working
directory. It always prints the revision number in which a match
appears.
By default, grep only prints output for the first revision of a file
in which it finds a match. To get it to print every revision that
contains a change in match status ("-" for a match that becomes a
non-match, or "+" for a non-match that becomes a match), use the
--all flag.
Returns 0 if a match is found, 1 otherwise.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.