Mercurial > repos > jpayne > cfsan_qaqc
Help: 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.
options ([+] can be repeated):
-0 | --print0 | end fields with NUL |
--all | print all revisions that match | |
-a | --text | treat all files as text |
-f | --follow | follow changeset history, or file history across copies and renames |
-i | --ignore-case | ignore case when matching |
-l | --files-with-matches | print only filenames and revisions that match |
-n | --line-number | print matching line numbers |
-r | --rev REV [+] | only search files changed within revision range |
-u | --user | list the author (long with -v) |
-d | --date | list the date (short with -q) |
-I | --include PATTERN [+] | include names matching the given patterns |
-X | --exclude PATTERN [+] | exclude names matching the given patterns |
global options ([+] can be repeated):
-R | --repository REPO | repository root directory or name of overlay bundle file |
--cwd DIR | change working directory | |
-y | --noninteractive | do not prompt, automatically pick the first choice for all prompts |
-q | --quiet | suppress output |
-v | --verbose | enable additional output |
--config CONFIG [+] | set/override config option (use 'section.name=value') | |
--debug | enable debugging output | |
--debugger | start debugger | |
--encoding ENCODE | set the charset encoding (default: UTF-8) | |
--encodingmode MODE | set the charset encoding mode (default: strict) | |
--traceback | always print a traceback on exception | |
--time | time how long the command takes | |
--profile | print command execution profile | |
--version | output version information and exit | |
-h | --help | display help and exit |
--hidden | consider hidden changesets |