| 1 |
.TH HG GREP "" "" "" |
| 2 |
.SH NAME |
| 3 |
hg grep \- search for a pattern in specified files |
| 4 |
.\" Man page generated from reStructuredText. |
| 5 |
. |
| 6 |
.SH SYNOPSIS |
| 7 |
.sp |
| 8 |
.nf |
| 9 |
.ft C |
| 10 |
hg grep [\-\-diff] [OPTION]... PATTERN [FILE]... |
| 11 |
.ft P |
| 12 |
.fi |
| 13 |
.SH DESCRIPTION |
| 14 |
.sp |
| 15 |
Search the working directory or revision history for a regular |
| 16 |
expression in the specified files for the entire repository. |
| 17 |
.sp |
| 18 |
By default, grep searches the repository files in the working |
| 19 |
directory and prints the files where it finds a match. To specify |
| 20 |
historical revisions instead of the working directory, use the |
| 21 |
\-\-rev flag. |
| 22 |
.sp |
| 23 |
To search instead historical revision differences that contains a |
| 24 |
change in match status ("\-" for a match that becomes a non\-match, |
| 25 |
or "+" for a non\-match that becomes a match), use the \-\-diff flag. |
| 26 |
.sp |
| 27 |
PATTERN can be any Python (roughly Perl\-compatible) regular |
| 28 |
expression. |
| 29 |
.sp |
| 30 |
If no FILEs are specified and the \-\-rev flag isn\(aqt supplied, all |
| 31 |
files in the working directory are searched. When using the \-\-rev |
| 32 |
flag and specifying FILEs, use the \-\-follow argument to also |
| 33 |
follow the specified FILEs across renames and copies. |
| 34 |
.sp |
| 35 |
Template: |
| 36 |
.sp |
| 37 |
The following keywords are supported in addition to the common template |
| 38 |
keywords and functions. See also \%\fBhg help templates\fP\:. |
| 39 |
.INDENT 0.0 |
| 40 |
.TP |
| 41 |
.B change |
| 42 |
. |
| 43 |
String. Character denoting insertion \fB+\fP or removal \fB\-\fP. |
| 44 |
Available if \fB\-\-diff\fP is specified. |
| 45 |
.TP |
| 46 |
.B lineno |
| 47 |
. |
| 48 |
Integer. Line number of the match. |
| 49 |
.TP |
| 50 |
.B path |
| 51 |
. |
| 52 |
String. Repository\-absolute path of the file. |
| 53 |
.TP |
| 54 |
.B texts |
| 55 |
. |
| 56 |
List of text chunks. |
| 57 |
.UNINDENT |
| 58 |
.sp |
| 59 |
And each entry of \fB{texts}\fP provides the following sub\-keywords. |
| 60 |
.INDENT 0.0 |
| 61 |
.TP |
| 62 |
.B matched |
| 63 |
. |
| 64 |
Boolean. True if the chunk matches the specified pattern. |
| 65 |
.TP |
| 66 |
.B text |
| 67 |
. |
| 68 |
String. Chunk content. |
| 69 |
.UNINDENT |
| 70 |
.sp |
| 71 |
See \%\fBhg help templates.operators\fP\: for the list expansion syntax. |
| 72 |
.sp |
| 73 |
Returns 0 if a match is found, 1 otherwise. |
| 74 |
.SH OPTIONS |
| 75 |
.INDENT 0.0 |
| 76 |
.TP |
| 77 |
.B \-0, \-\-print0 |
| 78 |
. |
| 79 |
end fields with NUL |
| 80 |
.TP |
| 81 |
.B \-\-all |
| 82 |
. |
| 83 |
an alias to \-\-diff (DEPRECATED) |
| 84 |
.TP |
| 85 |
.B \-\-diff |
| 86 |
. |
| 87 |
search revision differences for when the pattern was added or removed |
| 88 |
.TP |
| 89 |
.B \-a, \-\-text |
| 90 |
. |
| 91 |
treat all files as text |
| 92 |
.TP |
| 93 |
.B \-f, \-\-follow |
| 94 |
. |
| 95 |
follow changeset history, or file history across copies and renames |
| 96 |
.TP |
| 97 |
.B \-i, \-\-ignore\-case |
| 98 |
. |
| 99 |
ignore case when matching |
| 100 |
.TP |
| 101 |
.B \-l, \-\-files\-with\-matches |
| 102 |
. |
| 103 |
print only filenames and revisions that match |
| 104 |
.TP |
| 105 |
.B \-n, \-\-line\-number |
| 106 |
. |
| 107 |
print matching line numbers |
| 108 |
.TP |
| 109 |
.BI \-r, \-\-rev \ <REV[+]> |
| 110 |
. |
| 111 |
search files changed within revision range |
| 112 |
.TP |
| 113 |
.B \-\-all\-files |
| 114 |
. |
| 115 |
include all files in the changeset while grepping (DEPRECATED) |
| 116 |
.TP |
| 117 |
.B \-u, \-\-user |
| 118 |
. |
| 119 |
list the author (long with \-v) |
| 120 |
.TP |
| 121 |
.B \-d, \-\-date |
| 122 |
. |
| 123 |
list the date (short with \-q) |
| 124 |
.TP |
| 125 |
.BI \-T, \-\-template \ <TEMPLATE> |
| 126 |
. |
| 127 |
display with template |
| 128 |
.TP |
| 129 |
.BI \-I, \-\-include \ <PATTERN[+]> |
| 130 |
. |
| 131 |
include names matching the given patterns |
| 132 |
.TP |
| 133 |
.BI \-X, \-\-exclude \ <PATTERN[+]> |
| 134 |
. |
| 135 |
exclude names matching the given patterns |
| 136 |
.UNINDENT |
| 137 |
.sp |
| 138 |
[+] marked option can be specified multiple times |
| 139 |
.\" Generated by docutils manpage writer. |
| 140 |
.\" |
| 141 |
. |