Mercurial > hg
annotate mercurial/help/revsets.txt @ 12660:6ed5ae6264c2
revsets: add a sample query to the help for getting active branches
author | Brodie Rao <brodie@bitheap.org> |
---|---|
date | Sat, 09 Oct 2010 11:55:25 -0500 |
parents | 5aa5cbaf6efc |
children | f5735bb80d77 |
rev | line source |
---|---|
11382 | 1 Mercurial supports a functional language for selecting a set of |
2 revisions. | |
3 | |
4 The language supports a number of predicates which are joined by infix | |
5 operators. Parenthesis can be used for grouping. | |
6 | |
7 Identifiers such as branch names must be quoted with single or double | |
11420
a99ef3711890
revset: improve help on strings
Matt Mackall <mpm@selenic.com>
parents:
11382
diff
changeset
|
8 quotes if they contain characters outside of |
a99ef3711890
revset: improve help on strings
Matt Mackall <mpm@selenic.com>
parents:
11382
diff
changeset
|
9 ``[._a-zA-Z0-9\x80-\xff]`` or if they match one of the predefined |
12408
78a97859b90d
revset: support raw string literals
Brodie Rao <brodie@bitheap.org>
parents:
11944
diff
changeset
|
10 predicates. |
78a97859b90d
revset: support raw string literals
Brodie Rao <brodie@bitheap.org>
parents:
11944
diff
changeset
|
11 |
78a97859b90d
revset: support raw string literals
Brodie Rao <brodie@bitheap.org>
parents:
11944
diff
changeset
|
12 Special characters can be used in quoted identifiers by escaping them, |
78a97859b90d
revset: support raw string literals
Brodie Rao <brodie@bitheap.org>
parents:
11944
diff
changeset
|
13 e.g., ``\n`` is interpreted as a newline. To prevent them from being |
78a97859b90d
revset: support raw string literals
Brodie Rao <brodie@bitheap.org>
parents:
11944
diff
changeset
|
14 interpreted, strings can be prefixed with ``r``, e.g. ``r'...'``. |
11382 | 15 |
16 There is a single prefix operator: | |
17 | |
18 ``not x`` | |
19 Changesets not in x. Short form is ``! x``. | |
20 | |
21 These are the supported infix operators: | |
22 | |
23 ``x::y`` | |
24 A DAG range, meaning all changesets that are descendants of x and | |
25 ancestors of y, including x and y themselves. If the first endpoint | |
26 is left out, this is equivalent to ``ancestors(y)``, if the second | |
11450
6bca9801c92a
revset: fix spelling typo
Julian Cowley <julian@lava.net>
parents:
11420
diff
changeset
|
27 is left out it is equivalent to ``descendants(x)``. |
11382 | 28 |
29 An alternative syntax is ``x..y``. | |
30 | |
31 ``x:y`` | |
32 All changesets with revision numbers between x and y, both | |
33 inclusive. Either endpoint can be left out, they default to 0 and | |
34 tip. | |
35 | |
36 ``x and y`` | |
37 The intersection of changesets in x and y. Short form is ``x & y``. | |
38 | |
39 ``x or y`` | |
40 The union of changesets in x and y. There are two alternative short | |
41 forms: ``x | y`` and ``x + y``. | |
42 | |
43 ``x - y`` | |
44 Changesets in x but not in y. | |
45 | |
46 The following predicates are supported: | |
47 | |
48 ``adds(pattern)`` | |
49 Changesets that add a file matching pattern. | |
50 | |
51 ``all()`` | |
52 All changesets, the same as ``0:tip``. | |
53 | |
54 ``ancestor(single, single)`` | |
55 Greatest common ancestor of the two changesets. | |
56 | |
57 ``ancestors(set)`` | |
58 Changesets that are ancestors of a changeset in set. | |
59 | |
60 ``author(string)`` | |
61 Alias for ``user(string)``. | |
62 | |
63 ``branch(set)`` | |
11684
39bac1821b12
revsets.txt: minor improvements
Patrick Mezard <pmezard@gmail.com>
parents:
11450
diff
changeset
|
64 All changesets belonging to the branches of changesets in set. |
11382 | 65 |
66 ``children(set)`` | |
67 Child changesets of changesets in set. | |
68 | |
69 ``closed()`` | |
70 Changeset is closed. | |
71 | |
72 ``contains(pattern)`` | |
73 Revision contains pattern. | |
74 | |
75 ``date(interval)`` | |
76 Changesets within the interval, see :hg:`help dates`. | |
77 | |
78 ``descendants(set)`` | |
11684
39bac1821b12
revsets.txt: minor improvements
Patrick Mezard <pmezard@gmail.com>
parents:
11450
diff
changeset
|
79 Changesets which are descendants of changesets in set. |
11382 | 80 |
81 ``file(pattern)`` | |
11684
39bac1821b12
revsets.txt: minor improvements
Patrick Mezard <pmezard@gmail.com>
parents:
11450
diff
changeset
|
82 Changesets affecting files matched by pattern. |
11382 | 83 |
84 ``follow()`` | |
85 An alias for ``::.`` (ancestors of the working copy's first parent). | |
86 | |
87 ``grep(regex)`` | |
12408
78a97859b90d
revset: support raw string literals
Brodie Rao <brodie@bitheap.org>
parents:
11944
diff
changeset
|
88 Like ``keyword(string)`` but accepts a regex. Use ``grep(r'...')`` |
78a97859b90d
revset: support raw string literals
Brodie Rao <brodie@bitheap.org>
parents:
11944
diff
changeset
|
89 to ensure special escape characters are handled correctly. |
11382 | 90 |
91 ``head()`` | |
12657
7de9033167f3
revsets: clarify in the help that head() returns named branch heads
Brodie Rao <brodie@bitheap.org>
parents:
12408
diff
changeset
|
92 Changeset is a named branch head. |
11382 | 93 |
94 ``heads(set)`` | |
95 Members of set with no children in set. | |
96 | |
97 ``keyword(string)`` | |
98 Search commit message, user name, and names of changed files for | |
99 string. | |
100 | |
101 ``limit(set, n)`` | |
102 First n members of set. | |
103 | |
104 ``max(set)`` | |
105 Changeset with highest revision number in set. | |
106 | |
11708
ba65d61f3158
revset: add min function
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11684
diff
changeset
|
107 ``min(set)`` |
ba65d61f3158
revset: add min function
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11684
diff
changeset
|
108 Changeset with lowest revision number in set. |
ba65d61f3158
revset: add min function
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11684
diff
changeset
|
109 |
11382 | 110 ``merge()`` |
111 Changeset is a merge changeset. | |
112 | |
113 ``modifies(pattern)`` | |
11684
39bac1821b12
revsets.txt: minor improvements
Patrick Mezard <pmezard@gmail.com>
parents:
11450
diff
changeset
|
114 Changesets modifying files matched by pattern. |
11382 | 115 |
116 ``outgoing([path])`` | |
11684
39bac1821b12
revsets.txt: minor improvements
Patrick Mezard <pmezard@gmail.com>
parents:
11450
diff
changeset
|
117 Changesets not found in the specified destination repository, or the |
39bac1821b12
revsets.txt: minor improvements
Patrick Mezard <pmezard@gmail.com>
parents:
11450
diff
changeset
|
118 default push location. |
11382 | 119 |
120 ``p1(set)`` | |
121 First parent of changesets in set. | |
122 | |
123 ``p2(set)`` | |
124 Second parent of changesets in set. | |
125 | |
126 ``parents(set)`` | |
127 The set of all parents for all changesets in set. | |
128 | |
11944
df52ff0980fe
revset: predicate to avoid lookup errors
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
11708
diff
changeset
|
129 ``present(set)`` |
df52ff0980fe
revset: predicate to avoid lookup errors
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
11708
diff
changeset
|
130 An empty set, if any revision in set isn't found; otherwise, |
df52ff0980fe
revset: predicate to avoid lookup errors
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
11708
diff
changeset
|
131 all revisions in set. |
df52ff0980fe
revset: predicate to avoid lookup errors
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
11708
diff
changeset
|
132 |
11382 | 133 ``removes(pattern)`` |
134 Changesets which remove files matching pattern. | |
135 | |
136 ``reverse(set)`` | |
137 Reverse order of set. | |
138 | |
139 ``roots(set)`` | |
140 Changesets with no parent changeset in set. | |
141 | |
142 ``sort(set[, [-]key...])`` | |
143 Sort set by keys. The default sort order is ascending, specify a key | |
144 as ``-key`` to sort in descending order. | |
145 | |
146 The keys can be: | |
147 | |
148 - ``rev`` for the revision number, | |
149 - ``branch`` for the branch name, | |
150 - ``desc`` for the commit message (description), | |
151 - ``user`` for user name (``author`` can be used as an alias), | |
152 - ``date`` for the commit date | |
153 | |
154 ``tagged()`` | |
155 Changeset is tagged. | |
156 | |
157 ``user(string)`` | |
158 User name is string. | |
159 | |
160 Command line equivalents for :hg:`log`:: | |
161 | |
162 -f -> ::. | |
163 -d x -> date(x) | |
164 -k x -> keyword(x) | |
165 -m -> merge() | |
166 -u x -> user(x) | |
167 -b x -> branch(x) | |
168 -P x -> !::x | |
169 -l x -> limit(expr, x) | |
170 | |
12659
5aa5cbaf6efc
revsets: add descriptions for sample queries in the help
Brodie Rao <brodie@bitheap.org>
parents:
12657
diff
changeset
|
171 Some sample queries: |
5aa5cbaf6efc
revsets: add descriptions for sample queries in the help
Brodie Rao <brodie@bitheap.org>
parents:
12657
diff
changeset
|
172 |
5aa5cbaf6efc
revsets: add descriptions for sample queries in the help
Brodie Rao <brodie@bitheap.org>
parents:
12657
diff
changeset
|
173 - Changesets on the default branch:: |
5aa5cbaf6efc
revsets: add descriptions for sample queries in the help
Brodie Rao <brodie@bitheap.org>
parents:
12657
diff
changeset
|
174 |
5aa5cbaf6efc
revsets: add descriptions for sample queries in the help
Brodie Rao <brodie@bitheap.org>
parents:
12657
diff
changeset
|
175 hg log -r 'branch(default)' |
5aa5cbaf6efc
revsets: add descriptions for sample queries in the help
Brodie Rao <brodie@bitheap.org>
parents:
12657
diff
changeset
|
176 |
5aa5cbaf6efc
revsets: add descriptions for sample queries in the help
Brodie Rao <brodie@bitheap.org>
parents:
12657
diff
changeset
|
177 - Changesets on the default branch since tag 1.5 (excluding merges):: |
5aa5cbaf6efc
revsets: add descriptions for sample queries in the help
Brodie Rao <brodie@bitheap.org>
parents:
12657
diff
changeset
|
178 |
5aa5cbaf6efc
revsets: add descriptions for sample queries in the help
Brodie Rao <brodie@bitheap.org>
parents:
12657
diff
changeset
|
179 hg log -r 'branch(default) and 1.5:: and not merge()' |
11382 | 180 |
12660
6ed5ae6264c2
revsets: add a sample query to the help for getting active branches
Brodie Rao <brodie@bitheap.org>
parents:
12659
diff
changeset
|
181 - Open branch heads:: |
6ed5ae6264c2
revsets: add a sample query to the help for getting active branches
Brodie Rao <brodie@bitheap.org>
parents:
12659
diff
changeset
|
182 |
6ed5ae6264c2
revsets: add a sample query to the help for getting active branches
Brodie Rao <brodie@bitheap.org>
parents:
12659
diff
changeset
|
183 hg log -r 'head() and not closed()' |
6ed5ae6264c2
revsets: add a sample query to the help for getting active branches
Brodie Rao <brodie@bitheap.org>
parents:
12659
diff
changeset
|
184 |
12659
5aa5cbaf6efc
revsets: add descriptions for sample queries in the help
Brodie Rao <brodie@bitheap.org>
parents:
12657
diff
changeset
|
185 - Changesets between tags 1.3 and 1.5 mentioning "bug" that affect |
5aa5cbaf6efc
revsets: add descriptions for sample queries in the help
Brodie Rao <brodie@bitheap.org>
parents:
12657
diff
changeset
|
186 hgext/*:: |
5aa5cbaf6efc
revsets: add descriptions for sample queries in the help
Brodie Rao <brodie@bitheap.org>
parents:
12657
diff
changeset
|
187 |
5aa5cbaf6efc
revsets: add descriptions for sample queries in the help
Brodie Rao <brodie@bitheap.org>
parents:
12657
diff
changeset
|
188 hg log -r '1.3::1.5 and keyword(bug) and file("hgext/*")' |
5aa5cbaf6efc
revsets: add descriptions for sample queries in the help
Brodie Rao <brodie@bitheap.org>
parents:
12657
diff
changeset
|
189 |
5aa5cbaf6efc
revsets: add descriptions for sample queries in the help
Brodie Rao <brodie@bitheap.org>
parents:
12657
diff
changeset
|
190 - Changesets in committed May 2008, sorted by user:: |
5aa5cbaf6efc
revsets: add descriptions for sample queries in the help
Brodie Rao <brodie@bitheap.org>
parents:
12657
diff
changeset
|
191 |
5aa5cbaf6efc
revsets: add descriptions for sample queries in the help
Brodie Rao <brodie@bitheap.org>
parents:
12657
diff
changeset
|
192 hg log -r 'sort(date("May 2008"), user)' |
5aa5cbaf6efc
revsets: add descriptions for sample queries in the help
Brodie Rao <brodie@bitheap.org>
parents:
12657
diff
changeset
|
193 |
5aa5cbaf6efc
revsets: add descriptions for sample queries in the help
Brodie Rao <brodie@bitheap.org>
parents:
12657
diff
changeset
|
194 - Changesets mentioning "bug" or "issue" that are not in a tagged |
5aa5cbaf6efc
revsets: add descriptions for sample queries in the help
Brodie Rao <brodie@bitheap.org>
parents:
12657
diff
changeset
|
195 release:: |
5aa5cbaf6efc
revsets: add descriptions for sample queries in the help
Brodie Rao <brodie@bitheap.org>
parents:
12657
diff
changeset
|
196 |
5aa5cbaf6efc
revsets: add descriptions for sample queries in the help
Brodie Rao <brodie@bitheap.org>
parents:
12657
diff
changeset
|
197 hg log -r '(keyword(bug) or keyword(issue)) and not ancestors(tagged())' |