Is there a way to search ALL mercurial commits for a particular string?

We have a situation where we know the keyword used in one particular mercury commit in the repository. But we do not know what fixation is. Obviously, I can go through each committed file and eventually find the keyword and its use, but that would be tedious work.

Is there a way in mercurial to search a string through ALL fixed code in the repository?

+4
source share
1 answer

hg grep does just that.

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.
+4
source

Source: https://habr.com/ru/post/1532809/


All Articles