Debian Codegraph @

doc/html/topic-revisions.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>Specifying Revisions</title>
8 <link rel="stylesheet" href="../style.css" type="text/css" />
9 </head>
10 <body>
11 <div class="document" id="specifying-revisions">
12 <span id="topic-revisions"></span>
13 <h1 class="title">Specifying Revisions</h1>
14
15 <div class="contents htmlonly topic" id="contents">
16 <p class="topic-title"><a class="reference internal" href="#top">Contents</a></p>
17 <ul class="simple">
18 <li><a class="reference internal" href="#specifying-single-revisions" id="toc-entry-1">Specifying single revisions</a></li>
19 <li><a class="reference internal" href="#specifying-multiple-revisions" id="toc-entry-2">Specifying multiple revisions</a></li>
20 <li><a class="reference internal" href="#operators" id="toc-entry-3">Operators</a></li>
21 <li><a class="reference internal" href="#patterns" id="toc-entry-4">Patterns</a></li>
22 <li><a class="reference internal" href="#predicates" id="toc-entry-5">Predicates</a></li>
23 <li><a class="reference internal" href="#aliases" id="toc-entry-6">Aliases</a></li>
24 <li><a class="reference internal" href="#equivalents" id="toc-entry-7">Equivalents</a></li>
25 <li><a class="reference internal" href="#examples" id="toc-entry-8">Examples</a></li>
26 </ul>
27 </div>
28 <p id="mrevs"><span id="multirevs"></span><span id="revset"></span><span id="revsets"></span><span id="revs"></span><span id="revisions"></span>Mercurial supports several ways to specify revisions.</p>
29 <div class="section" id="specifying-single-revisions">
30 <h1><a class="toc-backref" href="#contents">Specifying single revisions</a></h1>
31 <p>A plain integer is treated as a revision number. Negative integers are
32 treated as sequential offsets from the tip, with -1 denoting the tip,
33 -2 denoting the revision prior to the tip, and so forth.</p>
34 <p>A 40-digit hexadecimal string is treated as a unique revision identifier.
35 A hexadecimal string less than 40 characters long is treated as a
36 unique revision identifier and is referred to as a short-form
37 identifier. A short-form identifier is only valid if it is the prefix
38 of exactly one full-length identifier.</p>
39 <p>Any other string is treated as a bookmark, tag, or branch name. A
40 bookmark is a movable pointer to a revision. A tag is a permanent name
41 associated with a revision. A branch name denotes the tipmost open branch head
42 of that branch - or if they are all closed, the tipmost closed head of the
43 branch. Bookmark, tag, and branch names must not contain the &quot;:&quot; character.</p>
44 <p>The reserved name &quot;tip&quot; always identifies the most recent revision.</p>
45 <p>The reserved name &quot;null&quot; indicates the null revision. This is the
46 revision of an empty repository, and the parent of revision 0.</p>
47 <p>The reserved name &quot;.&quot; indicates the working directory parent. If no
48 working directory is checked out, it is equivalent to null. If an
49 uncommitted merge is in progress, &quot;.&quot; is the revision of the first
50 parent.</p>
51 <p>Finally, commands that expect a single revision (like <tt class="docutils literal">hg update</tt>) also
52 accept revsets (see below for details). When given a revset, they use the
53 last revision of the revset. A few commands accept two single revisions
54 (like <tt class="docutils literal">hg diff</tt>). When given a revset, they use the first and the last
55 revisions of the revset.</p>
56 </div>
57 <div class="section" id="specifying-multiple-revisions">
58 <h1><a class="toc-backref" href="#contents">Specifying multiple revisions</a></h1>
59 <p>Mercurial supports a functional language for selecting a set of
60 revisions. Expressions in this language are called revsets.</p>
61 <p>The language supports a number of predicates which are joined by infix
62 operators. Parenthesis can be used for grouping.</p>
63 <p>Identifiers such as branch names may need quoting with single or
64 double quotes if they contain characters like <tt class="docutils literal">-</tt> or if they match
65 one of the predefined predicates.</p>
66 <p>Special characters can be used in quoted identifiers by escaping them,
67 e.g., <tt class="docutils literal">\n</tt> is interpreted as a newline. To prevent them from being
68 interpreted, strings can be prefixed with <tt class="docutils literal">r</tt>, e.g. <tt class="docutils literal"><span class="pre">r'...'</span></tt>.</p>
69 </div>
70 <div class="section" id="operators">
71 <h1><a class="toc-backref" href="#contents">Operators</a></h1>
72 <p>There is a single prefix operator:</p>
73 <dl class="docutils">
74 <dt><tt class="docutils literal">not x</tt></dt>
75 <dd>Changesets not in x. Short form is <tt class="docutils literal">! x</tt>.</dd>
76 </dl>
77 <p>These are the supported infix operators:</p>
78 <dl class="docutils">
79 <dt><tt class="docutils literal"><span class="pre">x::y</span></tt></dt>
80 <dd><p class="first">A DAG range, meaning all changesets that are descendants of x and
81 ancestors of y, including x and y themselves. If the first endpoint
82 is left out, this is equivalent to <tt class="docutils literal">ancestors(y)</tt>, if the second
83 is left out it is equivalent to <tt class="docutils literal">descendants(x)</tt>.</p>
84 <p class="last">An alternative syntax is <tt class="docutils literal"><span class="pre">x..y</span></tt>.</p>
85 </dd>
86 <dt><tt class="docutils literal">x:y</tt></dt>
87 <dd>All changesets with revision numbers between x and y, both
88 inclusive. Either endpoint can be left out, they default to 0 and
89 tip.</dd>
90 <dt><tt class="docutils literal">x and y</tt></dt>
91 <dd>The intersection of changesets in x and y. Short form is <tt class="docutils literal">x &amp; y</tt>.</dd>
92 <dt><tt class="docutils literal">x or y</tt></dt>
93 <dd>The union of changesets in x and y. There are two alternative short
94 forms: <tt class="docutils literal">x | y</tt> and <tt class="docutils literal">x + y</tt>.</dd>
95 <dt><tt class="docutils literal">x - y</tt></dt>
96 <dd>Changesets in x but not in y.</dd>
97 <dt><tt class="docutils literal">x % y</tt></dt>
98 <dd>Changesets that are ancestors of x but not ancestors of y (i.e. ::x - ::y).
99 This is shorthand notation for <tt class="docutils literal">only(x, y)</tt> (see below). The second
100 argument is optional and, if left out, is equivalent to <tt class="docutils literal">only(x)</tt>.</dd>
101 <dt><tt class="docutils literal">x^n</tt></dt>
102 <dd>The nth parent of x, n == 0, 1, or 2.
103 For n == 0, x; for n == 1, the first parent of each changeset in x;
104 for n == 2, the second parent of changeset in x.</dd>
105 <dt><tt class="docutils literal">x~n</tt></dt>
106 <dd>The nth first ancestor of x; <tt class="docutils literal">x~0</tt> is x; <tt class="docutils literal">x~3</tt> is <tt class="docutils literal"><span class="pre">x^^^</span></tt>.
107 For n &lt; 0, the nth unambiguous descendent of x.</dd>
108 <dt><tt class="docutils literal">x ## y</tt></dt>
109 <dd><p class="first">Concatenate strings and identifiers into one string.</p>
110 <p>All other prefix, infix and postfix operators have lower priority than
111 <tt class="docutils literal">##</tt>. For example, <tt class="docutils literal">a1 ## a2~2</tt> is equivalent to <tt class="docutils literal">(a1 ## <span class="pre">a2)~2</span></tt>.</p>
112 <p>For example:</p>
113 <pre class="literal-block">
114 [revsetalias]
115 issue(a1) = grep(r'\bissue[ :]?' ## a1 ## r'\b|\bbug\(' ## a1 ## r'\)')
116 </pre>
117 <p class="last"><tt class="docutils literal">issue(1234)</tt> is equivalent to
118 <tt class="docutils literal"><span class="pre">grep(r'\bissue[</span> <span class="pre">:]?1234\b|\bbug\(1234\)')</span></tt>
119 in this case. This matches against all of &quot;issue 1234&quot;, &quot;issue:1234&quot;,
120 &quot;issue1234&quot; and &quot;bug(1234)&quot;.</p>
121 </dd>
122 </dl>
123 <p>There is a single postfix operator:</p>
124 <dl class="docutils">
125 <dt><tt class="docutils literal">x^</tt></dt>
126 <dd>Equivalent to <tt class="docutils literal">x^1</tt>, the first parent of each changeset in x.</dd>
127 </dl>
128 </div>
129 <div class="section" id="patterns">
130 <h1><a class="toc-backref" href="#contents">Patterns</a></h1>
131 <p>Where noted, predicates that perform string matching can accept a pattern
132 string. The pattern may be either a literal, or a regular expression. If the
133 pattern starts with <tt class="docutils literal">re:</tt>, the remainder of the pattern is treated as a
134 regular expression. Otherwise, it is treated as a literal. To match a pattern
135 that actually starts with <tt class="docutils literal">re:</tt>, use the prefix <tt class="docutils literal">literal:</tt>.</p>
136 <p>Matching is case-sensitive, unless otherwise noted. To perform a case-
137 insensitive match on a case-sensitive predicate, use a regular expression,
138 prefixed with <tt class="docutils literal"><span class="pre">(?i)</span></tt>.</p>
139 <p>For example, <tt class="docutils literal"><span class="pre">tag(r're:(?i)release')</span></tt> matches &quot;release&quot; or &quot;RELEASE&quot;
140 or &quot;Release&quot;, etc.</p>
141 </div>
142 <div class="section" id="predicates">
143 <h1><a class="toc-backref" href="#contents">Predicates</a></h1>
144 <p>The following predicates are supported:</p>
145 <dl class="docutils">
146 <dt><tt class="docutils literal">adds(pattern)</tt></dt>
147 <dd><p class="first">Changesets that add a file matching pattern.</p>
148 <p class="last">The pattern without explicit kind like <tt class="docutils literal">glob:</tt> is expected to be
149 relative to the current directory and match against a file or a
150 directory.</p>
151 </dd>
152 <dt><tt class="docutils literal">all()</tt></dt>
153 <dd>All changesets, the same as <tt class="docutils literal">0:tip</tt>.</dd>
154 <dt><tt class="docutils literal"><span class="pre">ancestor(*changeset)</span></tt></dt>
155 <dd><p class="first">A greatest common ancestor of the changesets.</p>
156 <p class="last">Accepts 0 or more changesets.
157 Will return empty list when passed no args.
158 Greatest common ancestor of a single changeset is that changeset.</p>
159 </dd>
160 <dt><tt class="docutils literal">ancestors(set[, depth])</tt></dt>
161 <dd><p class="first">Changesets that are ancestors of changesets in set, including the
162 given changesets themselves.</p>
163 <p class="last">If depth is specified, the result only includes changesets up to
164 the specified generation.</p>
165 </dd>
166 <dt><tt class="docutils literal">author(string)</tt></dt>
167 <dd>Alias for <tt class="docutils literal">user(string)</tt>.</dd>
168 <dt><tt class="docutils literal">bisect(string)</tt></dt>
169 <dd><p class="first">Changesets marked in the specified bisect status:</p>
170 <ul class="last simple">
171 <li><tt class="docutils literal">good</tt>, <tt class="docutils literal">bad</tt>, <tt class="docutils literal">skip</tt>: csets explicitly marked as good/bad/skip</li>
172 <li><tt class="docutils literal">goods</tt>, <tt class="docutils literal">bads</tt> : csets topologically good/bad</li>
173 <li><tt class="docutils literal">range</tt> : csets taking part in the bisection</li>
174 <li><tt class="docutils literal">pruned</tt> : csets that are goods, bads or skipped</li>
175 <li><tt class="docutils literal">untested</tt> : csets whose fate is yet unknown</li>
176 <li><tt class="docutils literal">ignored</tt> : csets ignored due to DAG topology</li>
177 <li><tt class="docutils literal">current</tt> : the cset currently being bisected</li>
178 </ul>
179 </dd>
180 <dt><tt class="docutils literal"><span class="pre">bookmark([name])</span></tt></dt>
181 <dd><p class="first">The named bookmark or all bookmarks.</p>
182 <p class="last">Pattern matching is supported for <cite>name</cite>. See <a class="reference external" href="hg.1.html#revisions.patterns"><tt class="docutils literal">hg help revisions.patterns</tt></a>.</p>
183 </dd>
184 <dt><tt class="docutils literal">branch(string or set)</tt></dt>
185 <dd><p class="first">All changesets belonging to the given branch or the branches of the given
186 changesets.</p>
187 <p class="last">Pattern matching is supported for <cite>string</cite>. See
188 <a class="reference external" href="hg.1.html#revisions.patterns"><tt class="docutils literal">hg help revisions.patterns</tt></a>.</p>
189 </dd>
190 <dt><tt class="docutils literal">branchpoint()</tt></dt>
191 <dd>Changesets with more than one child.</dd>
192 <dt><tt class="docutils literal">bundle()</tt></dt>
193 <dd><p class="first">Changesets in the bundle.</p>
194 <p class="last">Bundle must be specified by the -R option.</p>
195 </dd>
196 <dt><tt class="docutils literal">children(set)</tt></dt>
197 <dd>Child changesets of changesets in set.</dd>
198 <dt><tt class="docutils literal">closed()</tt></dt>
199 <dd>Changeset is closed.</dd>
200 <dt><tt class="docutils literal">commonancestors(set)</tt></dt>
201 <dd>Changesets that are ancestors of every changeset in set.</dd>
202 <dt><tt class="docutils literal">conflictlocal()</tt></dt>
203 <dd><p class="first">The local side of the merge, if currently in an unresolved merge.</p>
204 <p class="last">&quot;merge&quot; here includes merge conflicts from e.g. 'hg rebase' or 'hg graft'.</p>
205 </dd>
206 <dt><tt class="docutils literal">conflictother()</tt></dt>
207 <dd><p class="first">The other side of the merge, if currently in an unresolved merge.</p>
208 <p class="last">&quot;merge&quot; here includes merge conflicts from e.g. 'hg rebase' or 'hg graft'.</p>
209 </dd>
210 <dt><tt class="docutils literal">contains(pattern)</tt></dt>
211 <dd><p class="first">The revision's manifest contains a file matching pattern (but might not
212 modify it). See <a class="reference external" href="topic-patterns.html"><tt class="docutils literal">hg help patterns</tt></a> for information about file patterns.</p>
213 <p class="last">The pattern without explicit kind like <tt class="docutils literal">glob:</tt> is expected to be
214 relative to the current directory and match against a file exactly
215 for efficiency.</p>
216 </dd>
217 <dt><tt class="docutils literal"><span class="pre">converted([id])</span></tt></dt>
218 <dd>Changesets converted from the given identifier in the old repository if
219 present, or all converted changesets if no identifier is specified.</dd>
220 <dt><tt class="docutils literal">date(interval)</tt></dt>
221 <dd>Changesets within the interval, see <a class="reference external" href="topic-dates.html"><tt class="docutils literal">hg help dates</tt></a>.</dd>
222 <dt><tt class="docutils literal">desc(string)</tt></dt>
223 <dd><p class="first">Search commit message for string. The match is case-insensitive.</p>
224 <p class="last">Pattern matching is supported for <cite>string</cite>. See
225 <a class="reference external" href="hg.1.html#revisions.patterns"><tt class="docutils literal">hg help revisions.patterns</tt></a>.</p>
226 </dd>
227 <dt><tt class="docutils literal">descendants(set[, depth])</tt></dt>
228 <dd><p class="first">Changesets which are descendants of changesets in set, including the
229 given changesets themselves.</p>
230 <p class="last">If depth is specified, the result only includes changesets up to
231 the specified generation.</p>
232 </dd>
233 <dt><tt class="docutils literal"><span class="pre">destination([set])</span></tt></dt>
234 <dd>Changesets that were created by a graft, transplant or rebase operation,
235 with the given revisions specified as the source. Omitting the optional set
236 is the same as passing all().</dd>
237 <dt><tt class="docutils literal">diffcontains(pattern)</tt></dt>
238 <dd><p class="first">Search revision differences for when the pattern was added or removed.</p>
239 <p class="last">The pattern may be a substring literal or a regular expression. See
240 <a class="reference external" href="hg.1.html#revisions.patterns"><tt class="docutils literal">hg help revisions.patterns</tt></a>.</p>
241 </dd>
242 <dt><tt class="docutils literal">draft()</tt></dt>
243 <dd>Changeset in draft phase.</dd>
244 <dt><tt class="docutils literal">expectsize(set[, size])</tt></dt>
245 <dd><p class="first">Return the given revset if size matches the revset size.
246 Abort if the revset doesn't expect given size.
247 size can either be an integer range or an integer.</p>
248 <p class="last">For example, <tt class="docutils literal">expectsize(0:1, 3:5)</tt> will abort as revset size is 2 and
249 2 is not between 3 and 5 inclusive.</p>
250 </dd>
251 <dt><tt class="docutils literal">extra(label, [value])</tt></dt>
252 <dd><p class="first">Changesets with the given label in the extra metadata, with the given
253 optional value.</p>
254 <p class="last">Pattern matching is supported for <cite>value</cite>. See
255 <a class="reference external" href="hg.1.html#revisions.patterns"><tt class="docutils literal">hg help revisions.patterns</tt></a>.</p>
256 </dd>
257 <dt><tt class="docutils literal">file(pattern)</tt></dt>
258 <dd><p class="first">Changesets affecting files matched by pattern.</p>
259 <p>For a faster but less accurate result, consider using <tt class="docutils literal">filelog()</tt>
260 instead.</p>
261 <p class="last">This predicate uses <tt class="docutils literal">glob:</tt> as the default kind of pattern.</p>
262 </dd>
263 <dt><tt class="docutils literal">filelog(pattern)</tt></dt>
264 <dd><p class="first">Changesets connected to the specified filelog.</p>
265 <p>For performance reasons, visits only revisions mentioned in the file-level
266 filelog, rather than filtering through all changesets (much faster, but
267 doesn't include deletes or duplicate changes). For a slower, more accurate
268 result, use <tt class="docutils literal">file()</tt>.</p>
269 <p class="last">The pattern without explicit kind like <tt class="docutils literal">glob:</tt> is expected to be
270 relative to the current directory and match against a file exactly
271 for efficiency.</p>
272 </dd>
273 <dt><tt class="docutils literal">first(set, [n])</tt></dt>
274 <dd>An alias for limit().</dd>
275 <dt><tt class="docutils literal"><span class="pre">follow([file[,</span> <span class="pre">startrev]])</span></tt></dt>
276 <dd>An alias for <tt class="docutils literal">::.</tt> (ancestors of the working directory's first parent).
277 If file pattern is specified, the histories of files matching given
278 pattern in the revision given by startrev are followed, including copies.</dd>
279 <dt><tt class="docutils literal">followlines(file, fromline:toline[, <span class="pre">startrev=.,</span> descend=False])</tt></dt>
280 <dd><p class="first">Changesets modifying <cite>file</cite> in line range ('fromline', 'toline').</p>
281 <p>Line range corresponds to 'file' content at 'startrev' and should hence be
282 consistent with file size. If startrev is not specified, working directory's
283 parent is used.</p>
284 <p class="last">By default, ancestors of 'startrev' are returned. If 'descend' is True,
285 descendants of 'startrev' are returned though renames are (currently) not
286 followed in this direction.</p>
287 </dd>
288 <dt><tt class="docutils literal">grep(regex)</tt></dt>
289 <dd>Like <tt class="docutils literal">keyword(string)</tt> but accepts a regex. Use <tt class="docutils literal"><span class="pre">grep(r'...')</span></tt>
290 to ensure special escape characters are handled correctly. Unlike
291 <tt class="docutils literal">keyword(string)</tt>, the match is case-sensitive.</dd>
292 <dt><tt class="docutils literal">head()</tt></dt>
293 <dd>Changeset is a named branch head.</dd>
294 <dt><tt class="docutils literal">heads(set)</tt></dt>
295 <dd>Members of set with no children in set.</dd>
296 <dt><tt class="docutils literal">hidden()</tt></dt>
297 <dd>Hidden changesets.</dd>
298 <dt><tt class="docutils literal">id(string)</tt></dt>
299 <dd>Revision non-ambiguously specified by the given hex string prefix.</dd>
300 <dt><tt class="docutils literal">keyword(string)</tt></dt>
301 <dd><p class="first">Search commit message, user name, and names of changed files for
302 string. The match is case-insensitive.</p>
303 <p class="last">For a regular expression or case sensitive search of these fields, use
304 <tt class="docutils literal">grep(regex)</tt>.</p>
305 </dd>
306 <dt><tt class="docutils literal">last(set, [n])</tt></dt>
307 <dd>Last n members of set, defaulting to 1.</dd>
308 <dt><tt class="docutils literal">limit(set[, n[, <span class="pre">offset]])</span></tt></dt>
309 <dd>First n members of set, defaulting to 1, starting from offset.</dd>
310 <dt><tt class="docutils literal">matching(revision [, field])</tt></dt>
311 <dd><p class="first">Changesets in which a given set of fields match the set of fields in the
312 selected revision or set.</p>
313 <p>To match more than one field pass the list of fields to match separated
314 by spaces (e.g. <tt class="docutils literal">author description</tt>).</p>
315 <p>Valid fields are most regular revision fields and some special fields.</p>
316 <p>Regular revision fields are <tt class="docutils literal">description</tt>, <tt class="docutils literal">author</tt>, <tt class="docutils literal">branch</tt>,
317 <tt class="docutils literal">date</tt>, <tt class="docutils literal">files</tt>, <tt class="docutils literal">phase</tt>, <tt class="docutils literal">parents</tt>, <tt class="docutils literal">substate</tt>, <tt class="docutils literal">user</tt>
318 and <tt class="docutils literal">diff</tt>.
319 Note that <tt class="docutils literal">author</tt> and <tt class="docutils literal">user</tt> are synonyms. <tt class="docutils literal">diff</tt> refers to the
320 contents of the revision. Two revisions matching their <tt class="docutils literal">diff</tt> will
321 also match their <tt class="docutils literal">files</tt>.</p>
322 <p>Special fields are <tt class="docutils literal">summary</tt> and <tt class="docutils literal">metadata</tt>:
323 <tt class="docutils literal">summary</tt> matches the first line of the description.
324 <tt class="docutils literal">metadata</tt> is equivalent to matching <tt class="docutils literal">description user date</tt>
325 (i.e. it matches the main metadata fields).</p>
326 <p class="last"><tt class="docutils literal">metadata</tt> is the default field which is used when no fields are
327 specified. You can match more than one field at a time.</p>
328 </dd>
329 <dt><tt class="docutils literal">max(set)</tt></dt>
330 <dd>Changeset with highest revision number in set.</dd>
331 <dt><tt class="docutils literal">merge()</tt></dt>
332 <dd>Changeset is a merge changeset.</dd>
333 <dt><tt class="docutils literal">min(set)</tt></dt>
334 <dd>Changeset with lowest revision number in set.</dd>
335 <dt><tt class="docutils literal">modifies(pattern)</tt></dt>
336 <dd><p class="first">Changesets modifying files matched by pattern.</p>
337 <p class="last">The pattern without explicit kind like <tt class="docutils literal">glob:</tt> is expected to be
338 relative to the current directory and match against a file or a
339 directory.</p>
340 </dd>
341 <dt><tt class="docutils literal">named(namespace)</tt></dt>
342 <dd><p class="first">The changesets in a given namespace.</p>
343 <p class="last">Pattern matching is supported for <cite>namespace</cite>. See
344 <a class="reference external" href="hg.1.html#revisions.patterns"><tt class="docutils literal">hg help revisions.patterns</tt></a>.</p>
345 </dd>
346 <dt><tt class="docutils literal">nodefromfile(path)</tt></dt>
347 <dd><p class="first">Read a list of nodes from the file at <cite>path</cite>.</p>
348 <p>This applies <cite>id(LINE)</cite> to each line of the file.</p>
349 <p class="last">This is useful when the amount of nodes you need to specify gets too large
350 for the command line.</p>
351 </dd>
352 <dt><tt class="docutils literal">none()</tt></dt>
353 <dd>No changesets.</dd>
354 <dt><tt class="docutils literal">only(set, [set])</tt></dt>
355 <dd>Changesets that are ancestors of the first set that are not ancestors
356 of any other head in the repo. If a second set is specified, the result
357 is ancestors of the first set that are not ancestors of the second set
358 (i.e. ::&lt;set1&gt; - ::&lt;set2&gt;).</dd>
359 <dt><tt class="docutils literal"><span class="pre">origin([set])</span></tt></dt>
360 <dd>Changesets that were specified as a source for the grafts, transplants or
361 rebases that created the given revisions. Omitting the optional set is the
362 same as passing all(). If a changeset created by these operations is itself
363 specified as a source for one of these operations, only the source changeset
364 for the first operation is selected.</dd>
365 <dt><tt class="docutils literal"><span class="pre">outgoing([path])</span></tt></dt>
366 <dd><p class="first">Changesets not found in the specified destination repository, or the
367 default push location.</p>
368 <p class="last">If the location resolve to multiple repositories, the union of all
369 outgoing changeset will be used.</p>
370 </dd>
371 <dt><tt class="docutils literal"><span class="pre">p1([set])</span></tt></dt>
372 <dd>First parent of changesets in set, or the working directory.</dd>
373 <dt><tt class="docutils literal"><span class="pre">p2([set])</span></tt></dt>
374 <dd>Second parent of changesets in set, or the working directory.</dd>
375 <dt><tt class="docutils literal"><span class="pre">parents([set])</span></tt></dt>
376 <dd>The set of all parents for all changesets in set, or the working directory.</dd>
377 <dt><tt class="docutils literal">present(set)</tt></dt>
378 <dd><p class="first">An empty set, if any revision in set isn't found; otherwise,
379 all revisions in set.</p>
380 <p class="last">If any of specified revisions is not present in the local repository,
381 the query is normally aborted. But this predicate allows the query
382 to continue even in such cases.</p>
383 </dd>
384 <dt><tt class="docutils literal">public()</tt></dt>
385 <dd>Changeset in public phase.</dd>
386 <dt><tt class="docutils literal"><span class="pre">remote([id</span> <span class="pre">[,path]])</span></tt></dt>
387 <dd>Local revision that corresponds to the given identifier in a
388 remote repository, if present. Here, the '.' identifier is a
389 synonym for the current local branch.</dd>
390 <dt><tt class="docutils literal">removes(pattern)</tt></dt>
391 <dd><p class="first">Changesets which remove files matching pattern.</p>
392 <p class="last">The pattern without explicit kind like <tt class="docutils literal">glob:</tt> is expected to be
393 relative to the current directory and match against a file or a
394 directory.</p>
395 </dd>
396 <dt><tt class="docutils literal">rev(number)</tt></dt>
397 <dd>Revision with the given numeric identifier.</dd>
398 <dt><tt class="docutils literal">reverse(set)</tt></dt>
399 <dd>Reverse order of set.</dd>
400 <dt><tt class="docutils literal">revset(set)</tt></dt>
401 <dd><p class="first">Strictly interpret the content as a revset.</p>
402 <p class="last">The content of this special predicate will be strictly interpreted as a
403 revset. For example, <tt class="docutils literal">revset(id(0))</tt> will be interpreted as &quot;id(0)&quot;
404 without possible ambiguity with a &quot;id(0)&quot; bookmark or tag.</p>
405 </dd>
406 <dt><tt class="docutils literal">roots(set)</tt></dt>
407 <dd>Changesets in set with no parent changeset in set.</dd>
408 <dt><tt class="docutils literal">secret()</tt></dt>
409 <dd>Changeset in secret phase.</dd>
410 <dt><tt class="docutils literal">sort(set[, <span class="pre">[-]key...</span> [, <span class="pre">...]])</span></tt></dt>
411 <dd><p class="first">Sort set by keys. The default sort order is ascending, specify a key
412 as <tt class="docutils literal"><span class="pre">-key</span></tt> to sort in descending order.</p>
413 <p>The keys can be:</p>
414 <ul class="simple">
415 <li><tt class="docutils literal">rev</tt> for the revision number,</li>
416 <li><tt class="docutils literal">branch</tt> for the branch name,</li>
417 <li><tt class="docutils literal">desc</tt> for the commit message (description),</li>
418 <li><tt class="docutils literal">user</tt> for user name (<tt class="docutils literal">author</tt> can be used as an alias),</li>
419 <li><tt class="docutils literal">date</tt> for the commit date</li>
420 <li><tt class="docutils literal">topo</tt> for a reverse topographical sort</li>
421 <li><tt class="docutils literal">node</tt> the nodeid of the revision</li>
422 <li><tt class="docutils literal">random</tt> randomly shuffle revisions</li>
423 </ul>
424 <p>The <tt class="docutils literal">topo</tt> sort order cannot be combined with other sort keys. This sort
425 takes one optional argument, <tt class="docutils literal">topo.firstbranch</tt>, which takes a revset that
426 specifies what topographical branches to prioritize in the sort.</p>
427 <p class="last">The <tt class="docutils literal">random</tt> sort takes one optional <tt class="docutils literal">random.seed</tt> argument to control
428 the pseudo-randomness of the result.</p>
429 </dd>
430 <dt><tt class="docutils literal"><span class="pre">subrepo([pattern])</span></tt></dt>
431 <dd>Changesets that add, modify or remove the given subrepo. If no subrepo
432 pattern is named, any subrepo changes are returned.</dd>
433 <dt><tt class="docutils literal"><span class="pre">tag([name])</span></tt></dt>
434 <dd><p class="first">The specified tag by name, or all tagged revisions if no name is given.</p>
435 <p class="last">Pattern matching is supported for <cite>name</cite>. See
436 <a class="reference external" href="hg.1.html#revisions.patterns"><tt class="docutils literal">hg help revisions.patterns</tt></a>.</p>
437 </dd>
438 <dt><tt class="docutils literal">user(string)</tt></dt>
439 <dd><p class="first">User name contains string. The match is case-insensitive.</p>
440 <p class="last">Pattern matching is supported for <cite>string</cite>. See
441 <a class="reference external" href="hg.1.html#revisions.patterns"><tt class="docutils literal">hg help revisions.patterns</tt></a>.</p>
442 </dd>
443 </dl>
444 </div>
445 <div class="section" id="aliases">
446 <h1><a class="toc-backref" href="#contents">Aliases</a></h1>
447 <p>New predicates (known as &quot;aliases&quot;) can be defined, using any combination of
448 existing predicates or other aliases. An alias definition looks like:</p>
449 <pre class="literal-block">
450 &lt;alias&gt; = &lt;definition&gt;
451 </pre>
452 <p>in the <tt class="docutils literal">revsetalias</tt> section of a Mercurial configuration file. Arguments
453 of the form <cite>a1</cite>, <cite>a2</cite>, etc. are substituted from the alias into the
454 definition.</p>
455 <p>For example,</p>
456 <pre class="literal-block">
457 [revsetalias]
458 h = heads()
459 d(s) = sort(s, date)
460 rs(s, k) = reverse(sort(s, k))
461 </pre>
462 <p>defines three aliases, <tt class="docutils literal">h</tt>, <tt class="docutils literal">d</tt>, and <tt class="docutils literal">rs</tt>. <tt class="docutils literal">rs(0:tip, author)</tt> is
463 exactly equivalent to <tt class="docutils literal">reverse(sort(0:tip, author))</tt>.</p>
464 </div>
465 <div class="section" id="equivalents">
466 <h1><a class="toc-backref" href="#contents">Equivalents</a></h1>
467 <p>Command line equivalents for <a class="reference external" href="hg-log.html"><tt class="docutils literal">hg log</tt></a>:</p>
468 <pre class="literal-block">
469 -f -&gt; ::.
470 -d x -&gt; date(x)
471 -k x -&gt; keyword(x)
472 -m -&gt; merge()
473 -u x -&gt; user(x)
474 -b x -&gt; branch(x)
475 -P x -&gt; !::x
476 -l x -&gt; limit(expr, x)
477 </pre>
478 </div>
479 <div class="section" id="examples">
480 <h1><a class="toc-backref" href="#contents">Examples</a></h1>
481 <p>Some sample queries:</p>
482 <ul>
483 <li><p class="first">Changesets on the default branch:</p>
484 <pre class="literal-block">
485 hg log -r &quot;branch(default)&quot;
486 </pre>
487 </li>
488 <li><p class="first">Changesets on the default branch since tag 1.5 (excluding merges):</p>
489 <pre class="literal-block">
490 hg log -r &quot;branch(default) and 1.5:: and not merge()&quot;
491 </pre>
492 </li>
493 <li><p class="first">Open branch heads:</p>
494 <pre class="literal-block">
495 hg log -r &quot;head() and not closed()&quot;
496 </pre>
497 </li>
498 <li><p class="first">Changesets between tags 1.3 and 1.5 mentioning &quot;bug&quot; that affect
499 <tt class="docutils literal">hgext/*</tt>:</p>
500 <pre class="literal-block">
501 hg log -r &quot;1.3::1.5 and keyword(bug) and file('hgext/*')&quot;
502 </pre>
503 </li>
504 <li><p class="first">Changesets committed in May 2008, sorted by user:</p>
505 <pre class="literal-block">
506 hg log -r &quot;sort(date('May 2008'), user)&quot;
507 </pre>
508 </li>
509 <li><p class="first">Changesets mentioning &quot;bug&quot; or &quot;issue&quot; that are not in a tagged
510 release:</p>
511 <pre class="literal-block">
512 hg log -r &quot;(keyword(bug) or keyword(issue)) and not ancestors(tag())&quot;
513 </pre>
514 </li>
515 <li><p class="first">Update to the commit that bookmark &#64; is pointing to, without activating the
516 bookmark (this works because the last revision of the revset is used):</p>
517 <pre class="literal-block">
518 hg update :&#64;
519 </pre>
520 </li>
521 <li><p class="first">Show diff between tags 1.3 and 1.5 (this works because the first and the
522 last revisions of the revset are used):</p>
523 <pre class="literal-block">
524 hg diff -r 1.3::1.5
525 </pre>
526 </li>
527 </ul>
528 </div>
529 </div>
530 </body>
531 </html>