Debian Codegraph @

doc/html/hg-grep.html

raw
1 <?xml version="1.0" encoding="utf-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6 <meta name="generator" content="Docutils 0.21.2: https://docutils.sourceforge.io/" />
7 <title>hg grep</title>
8 <link rel="stylesheet" href="../style.css" type="text/css" />
9 </head>
10 <body>
11 <div class="document" id="hg-grep">
12 <span id="hg-grep-1"></span>
13 <h1 class="title">hg grep</h1>
14 <h2 class="subtitle" id="search-for-a-pattern-in-specified-files">search for a pattern in specified files</h2>
15
16 <div class="contents htmlonly topic" id="contents">
17 <p class="topic-title"><a class="reference internal" href="#top">Contents</a></p>
18 <ul class="simple">
19 <li><a class="reference internal" href="#synopsis" id="toc-entry-1">Synopsis</a></li>
20 <li><a class="reference internal" href="#description" id="toc-entry-2">Description</a></li>
21 <li><a class="reference internal" href="#options" id="toc-entry-3">Options</a></li>
22 </ul>
23 </div>
24 <div class="section" id="synopsis">
25 <h1><a class="toc-backref" href="#contents">Synopsis</a></h1>
26 <pre class="literal-block">
27 hg grep [--diff] [OPTION]... PATTERN [FILE]...
28 </pre>
29 </div>
30 <div class="section" id="description">
31 <h1><a class="toc-backref" href="#contents">Description</a></h1>
32 <p>Search the working directory or revision history for a regular
33 expression in the specified files for the entire repository.</p>
34 <p>By default, grep searches the repository files in the working
35 directory and prints the files where it finds a match. To specify
36 historical revisions instead of the working directory, use the
37 --rev flag.</p>
38 <p>To search instead historical revision differences that contains a
39 change in match status (&quot;-&quot; for a match that becomes a non-match,
40 or &quot;+&quot; for a non-match that becomes a match), use the --diff flag.</p>
41 <p>PATTERN can be any Python (roughly Perl-compatible) regular
42 expression.</p>
43 <p>If no FILEs are specified and the --rev flag isn't supplied, all
44 files in the working directory are searched. When using the --rev
45 flag and specifying FILEs, use the --follow argument to also
46 follow the specified FILEs across renames and copies.</p>
47 <div class="verbose docutils container">
48 <p>Template:</p>
49 <p>The following keywords are supported in addition to the common template
50 keywords and functions. See also <a class="reference external" href="hg.1.html#templates"><tt class="docutils literal">hg help templates</tt></a>.</p>
51 <table class="docutils field-list" frame="void" rules="none">
52 <col class="field-name" />
53 <col class="field-body" />
54 <tbody valign="top">
55 <tr class="field"><th class="field-name">change:</th><td class="field-body">String. Character denoting insertion <tt class="docutils literal">+</tt> or removal <tt class="docutils literal">-</tt>.
56 Available if <tt class="docutils literal"><span class="pre">--diff</span></tt> is specified.</td>
57 </tr>
58 <tr class="field"><th class="field-name">lineno:</th><td class="field-body">Integer. Line number of the match.</td>
59 </tr>
60 <tr class="field"><th class="field-name">path:</th><td class="field-body">String. Repository-absolute path of the file.</td>
61 </tr>
62 <tr class="field"><th class="field-name">texts:</th><td class="field-body">List of text chunks.</td>
63 </tr>
64 </tbody>
65 </table>
66 <p>And each entry of <tt class="docutils literal">{texts}</tt> provides the following sub-keywords.</p>
67 <table class="docutils field-list" frame="void" rules="none">
68 <col class="field-name" />
69 <col class="field-body" />
70 <tbody valign="top">
71 <tr class="field"><th class="field-name">matched:</th><td class="field-body">Boolean. True if the chunk matches the specified pattern.</td>
72 </tr>
73 <tr class="field"><th class="field-name">text:</th><td class="field-body">String. Chunk content.</td>
74 </tr>
75 </tbody>
76 </table>
77 <p>See <a class="reference external" href="hg.1.html#templates.operators"><tt class="docutils literal">hg help templates.operators</tt></a> for the list expansion syntax.</p>
78 </div>
79 <p>Returns 0 if a match is found, 1 otherwise.</p>
80 </div>
81 <div class="section" id="options">
82 <h1><a class="toc-backref" href="#contents">Options</a></h1>
83 <table class="docutils option-list" frame="void" rules="none">
84 <col class="option" />
85 <col class="description" />
86 <tbody valign="top">
87 <tr><td class="option-group">
88 <kbd><span class="option">-0</span>, <span class="option">--print0</span></kbd></td>
89 <td>end fields with NUL</td></tr>
90 <tr><td class="option-group">
91 <kbd><span class="option">--all</span></kbd></td>
92 <td>an alias to --diff (DEPRECATED)</td></tr>
93 <tr><td class="option-group">
94 <kbd><span class="option">--diff</span></kbd></td>
95 <td>search revision differences for when the pattern was added or removed</td></tr>
96 <tr><td class="option-group">
97 <kbd><span class="option">-a</span>, <span class="option">--text</span></kbd></td>
98 <td>treat all files as text</td></tr>
99 <tr><td class="option-group">
100 <kbd><span class="option">-f</span>, <span class="option">--follow</span></kbd></td>
101 <td>follow changeset history, or file history across copies and renames</td></tr>
102 <tr><td class="option-group" colspan="2">
103 <kbd><span class="option">-i</span>, <span class="option">--ignore-case</span></kbd></td>
104 </tr>
105 <tr><td>&nbsp;</td><td>ignore case when matching</td></tr>
106 <tr><td class="option-group" colspan="2">
107 <kbd><span class="option">-l</span>, <span class="option">--files-with-matches</span></kbd></td>
108 </tr>
109 <tr><td>&nbsp;</td><td>print only filenames and revisions that match</td></tr>
110 <tr><td class="option-group" colspan="2">
111 <kbd><span class="option">-n</span>, <span class="option">--line-number</span></kbd></td>
112 </tr>
113 <tr><td>&nbsp;</td><td>print matching line numbers</td></tr>
114 <tr><td class="option-group" colspan="2">
115 <kbd><span class="option">-r</span>, <span class="option">--rev <var>&lt;REV[+]&gt;</var></span></kbd></td>
116 </tr>
117 <tr><td>&nbsp;</td><td>search files changed within revision range</td></tr>
118 <tr><td class="option-group">
119 <kbd><span class="option">--all-files</span></kbd></td>
120 <td>include all files in the changeset while grepping (DEPRECATED)</td></tr>
121 <tr><td class="option-group">
122 <kbd><span class="option">-u</span>, <span class="option">--user</span></kbd></td>
123 <td>list the author (long with -v)</td></tr>
124 <tr><td class="option-group">
125 <kbd><span class="option">-d</span>, <span class="option">--date</span></kbd></td>
126 <td>list the date (short with -q)</td></tr>
127 <tr><td class="option-group" colspan="2">
128 <kbd><span class="option">-T</span>, <span class="option">--template <var>&lt;TEMPLATE&gt;</var></span></kbd></td>
129 </tr>
130 <tr><td>&nbsp;</td><td>display with template</td></tr>
131 <tr><td class="option-group" colspan="2">
132 <kbd><span class="option">-I</span>, <span class="option">--include <var>&lt;PATTERN[+]&gt;</var></span></kbd></td>
133 </tr>
134 <tr><td>&nbsp;</td><td>include names matching the given patterns</td></tr>
135 <tr><td class="option-group" colspan="2">
136 <kbd><span class="option">-X</span>, <span class="option">--exclude <var>&lt;PATTERN[+]&gt;</var></span></kbd></td>
137 </tr>
138 <tr><td>&nbsp;</td><td>exclude names matching the given patterns</td></tr>
139 </tbody>
140 </table>
141 <p>[+] marked option can be specified multiple times</p>
142 </div>
143 </div>
144 </body>
145 </html>