gpt4 book ai didi

version-control - 有没有办法搜索特定字符串的所有 mercurial 提交?

转载 作者:行者123 更新时间:2023-12-04 19:06:50 25 4
gpt4 key购买 nike

我们有一种情况,我们知道在存储库中的一个特定的 mercurial 提交中使用的关键字。但是我们不知道提交的内容是什么。显然我可以遍历每个提交的文件并最终找到关键字及其使用方式,但这将是一项繁琐的工作。

有没有办法在 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.

关于version-control - 有没有办法搜索特定字符串的所有 mercurial 提交?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22556983/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com