author | Erik Zielke <ez@aragost.com> |
Wed, 22 Sep 2010 15:51:59 +0200 | |
changeset 12388 | 75f044d4dbf5 |
parent 11944 | df52ff0980fe |
child 12408 | 78a97859b90d |
permissions | -rw-r--r-- |
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 |
a99ef3711890
revset: improve help on strings
Matt Mackall <mpm@selenic.com>
parents:
11382
diff
changeset
|
10 |
predicates. Special characters can be used in quoted identifiers by |
a99ef3711890
revset: improve help on strings
Matt Mackall <mpm@selenic.com>
parents:
11382
diff
changeset
|
11 |
escaping them, e.g., ``\n`` is interpreted as a newline. |
11382 | 12 |
|
13 |
There is a single prefix operator: |
|
14 |
||
15 |
``not x`` |
|
16 |
Changesets not in x. Short form is ``! x``. |
|
17 |
||
18 |
These are the supported infix operators: |
|
19 |
||
20 |
``x::y`` |
|
21 |
A DAG range, meaning all changesets that are descendants of x and |
|
22 |
ancestors of y, including x and y themselves. If the first endpoint |
|
23 |
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
|
24 |
is left out it is equivalent to ``descendants(x)``. |
11382 | 25 |
|
26 |
An alternative syntax is ``x..y``. |
|
27 |
||
28 |
``x:y`` |
|
29 |
All changesets with revision numbers between x and y, both |
|
30 |
inclusive. Either endpoint can be left out, they default to 0 and |
|
31 |
tip. |
|
32 |
||
33 |
``x and y`` |
|
34 |
The intersection of changesets in x and y. Short form is ``x & y``. |
|
35 |
||
36 |
``x or y`` |
|
37 |
The union of changesets in x and y. There are two alternative short |
|
38 |
forms: ``x | y`` and ``x + y``. |
|
39 |
||
40 |
``x - y`` |
|
41 |
Changesets in x but not in y. |
|
42 |
||
43 |
The following predicates are supported: |
|
44 |
||
45 |
``adds(pattern)`` |
|
46 |
Changesets that add a file matching pattern. |
|
47 |
||
48 |
``all()`` |
|
49 |
All changesets, the same as ``0:tip``. |
|
50 |
||
51 |
``ancestor(single, single)`` |
|
52 |
Greatest common ancestor of the two changesets. |
|
53 |
||
54 |
``ancestors(set)`` |
|
55 |
Changesets that are ancestors of a changeset in set. |
|
56 |
||
57 |
``author(string)`` |
|
58 |
Alias for ``user(string)``. |
|
59 |
||
60 |
``branch(set)`` |
|
11684
39bac1821b12
revsets.txt: minor improvements
Patrick Mezard <pmezard@gmail.com>
parents:
11450
diff
changeset
|
61 |
All changesets belonging to the branches of changesets in set. |
11382 | 62 |
|
63 |
``children(set)`` |
|
64 |
Child changesets of changesets in set. |
|
65 |
||
66 |
``closed()`` |
|
67 |
Changeset is closed. |
|
68 |
||
69 |
``contains(pattern)`` |
|
70 |
Revision contains pattern. |
|
71 |
||
72 |
``date(interval)`` |
|
73 |
Changesets within the interval, see :hg:`help dates`. |
|
74 |
||
75 |
``descendants(set)`` |
|
11684
39bac1821b12
revsets.txt: minor improvements
Patrick Mezard <pmezard@gmail.com>
parents:
11450
diff
changeset
|
76 |
Changesets which are descendants of changesets in set. |
11382 | 77 |
|
78 |
``file(pattern)`` |
|
11684
39bac1821b12
revsets.txt: minor improvements
Patrick Mezard <pmezard@gmail.com>
parents:
11450
diff
changeset
|
79 |
Changesets affecting files matched by pattern. |
11382 | 80 |
|
81 |
``follow()`` |
|
82 |
An alias for ``::.`` (ancestors of the working copy's first parent). |
|
83 |
||
84 |
``grep(regex)`` |
|
85 |
Like ``keyword(string)`` but accepts a regex. |
|
86 |
||
87 |
``head()`` |
|
88 |
Changeset is a head. |
|
89 |
||
90 |
``heads(set)`` |
|
91 |
Members of set with no children in set. |
|
92 |
||
93 |
``keyword(string)`` |
|
94 |
Search commit message, user name, and names of changed files for |
|
95 |
string. |
|
96 |
||
97 |
``limit(set, n)`` |
|
98 |
First n members of set. |
|
99 |
||
100 |
``max(set)`` |
|
101 |
Changeset with highest revision number in set. |
|
102 |
||
11708
ba65d61f3158
revset: add min function
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11684
diff
changeset
|
103 |
``min(set)`` |
ba65d61f3158
revset: add min function
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11684
diff
changeset
|
104 |
Changeset with lowest revision number in set. |
ba65d61f3158
revset: add min function
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11684
diff
changeset
|
105 |
|
11382 | 106 |
``merge()`` |
107 |
Changeset is a merge changeset. |
|
108 |
||
109 |
``modifies(pattern)`` |
|
11684
39bac1821b12
revsets.txt: minor improvements
Patrick Mezard <pmezard@gmail.com>
parents:
11450
diff
changeset
|
110 |
Changesets modifying files matched by pattern. |
11382 | 111 |
|
112 |
``outgoing([path])`` |
|
11684
39bac1821b12
revsets.txt: minor improvements
Patrick Mezard <pmezard@gmail.com>
parents:
11450
diff
changeset
|
113 |
Changesets not found in the specified destination repository, or the |
39bac1821b12
revsets.txt: minor improvements
Patrick Mezard <pmezard@gmail.com>
parents:
11450
diff
changeset
|
114 |
default push location. |
11382 | 115 |
|
116 |
``p1(set)`` |
|
117 |
First parent of changesets in set. |
|
118 |
||
119 |
``p2(set)`` |
|
120 |
Second parent of changesets in set. |
|
121 |
||
122 |
``parents(set)`` |
|
123 |
The set of all parents for all changesets in set. |
|
124 |
||
11944
df52ff0980fe
revset: predicate to avoid lookup errors
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
11708
diff
changeset
|
125 |
``present(set)`` |
df52ff0980fe
revset: predicate to avoid lookup errors
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
11708
diff
changeset
|
126 |
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
|
127 |
all revisions in set. |
df52ff0980fe
revset: predicate to avoid lookup errors
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
11708
diff
changeset
|
128 |
|
11382 | 129 |
``removes(pattern)`` |
130 |
Changesets which remove files matching pattern. |
|
131 |
||
132 |
``reverse(set)`` |
|
133 |
Reverse order of set. |
|
134 |
||
135 |
``roots(set)`` |
|
136 |
Changesets with no parent changeset in set. |
|
137 |
||
138 |
``sort(set[, [-]key...])`` |
|
139 |
Sort set by keys. The default sort order is ascending, specify a key |
|
140 |
as ``-key`` to sort in descending order. |
|
141 |
||
142 |
The keys can be: |
|
143 |
||
144 |
- ``rev`` for the revision number, |
|
145 |
- ``branch`` for the branch name, |
|
146 |
- ``desc`` for the commit message (description), |
|
147 |
- ``user`` for user name (``author`` can be used as an alias), |
|
148 |
- ``date`` for the commit date |
|
149 |
||
150 |
``tagged()`` |
|
151 |
Changeset is tagged. |
|
152 |
||
153 |
``user(string)`` |
|
154 |
User name is string. |
|
155 |
||
156 |
Command line equivalents for :hg:`log`:: |
|
157 |
||
158 |
-f -> ::. |
|
159 |
-d x -> date(x) |
|
160 |
-k x -> keyword(x) |
|
161 |
-m -> merge() |
|
162 |
-u x -> user(x) |
|
163 |
-b x -> branch(x) |
|
164 |
-P x -> !::x |
|
165 |
-l x -> limit(expr, x) |
|
166 |
||
167 |
Some sample queries:: |
|
168 |
||
169 |
hg log -r 'branch(default)' |
|
170 |
hg log -r 'branch(default) and 1.5:: and not merge()' |
|
171 |
hg log -r '1.3::1.5 and keyword(bug) and file("hgext/*")' |
|
172 |
hg log -r 'sort(date("May 2008"), user)' |
|
173 |
hg log -r '(keyword(bug) or keyword(issue)) and not ancestors(tagged())' |