Ang*_*ber 5 version-control mercurial
在一种情况下,我们知道存储库中某个特定的商品提交中使用的关键字。但是我们不知道其中包含什么提交。显然,我可以遍历每个提交的文件并最终找到关键字及其用法,但这将是很多繁琐的工作。
有没有办法在存储库中所有已提交的代码中搜索字符串?
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.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
643 次 |
| 最近记录: |