author | Pradeepkumar Gayam <in3xes@gmail.com> |
Tue, 10 Aug 2010 22:28:52 +0530 | |
changeset 11934 | cf858e76e992 |
parent 11708 | ba65d61f3158 |
child 11944 | df52ff0980fe |
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 |
||
125 |
``removes(pattern)`` |
|
126 |
Changesets which remove files matching pattern. |
|
127 |
||
128 |
``reverse(set)`` |
|
129 |
Reverse order of set. |
|
130 |
||
131 |
``roots(set)`` |
|
132 |
Changesets with no parent changeset in set. |
|
133 |
||
134 |
``sort(set[, [-]key...])`` |
|
135 |
Sort set by keys. The default sort order is ascending, specify a key |
|
136 |
as ``-key`` to sort in descending order. |
|
137 |
||
138 |
The keys can be: |
|
139 |
||
140 |
- ``rev`` for the revision number, |
|
141 |
- ``branch`` for the branch name, |
|
142 |
- ``desc`` for the commit message (description), |
|
143 |
- ``user`` for user name (``author`` can be used as an alias), |
|
144 |
- ``date`` for the commit date |
|
145 |
||
146 |
``tagged()`` |
|
147 |
Changeset is tagged. |
|
148 |
||
149 |
``user(string)`` |
|
150 |
User name is string. |
|
151 |
||
152 |
Command line equivalents for :hg:`log`:: |
|
153 |
||
154 |
-f -> ::. |
|
155 |
-d x -> date(x) |
|
156 |
-k x -> keyword(x) |
|
157 |
-m -> merge() |
|
158 |
-u x -> user(x) |
|
159 |
-b x -> branch(x) |
|
160 |
-P x -> !::x |
|
161 |
-l x -> limit(expr, x) |
|
162 |
||
163 |
Some sample queries:: |
|
164 |
||
165 |
hg log -r 'branch(default)' |
|
166 |
hg log -r 'branch(default) and 1.5:: and not merge()' |
|
167 |
hg log -r '1.3::1.5 and keyword(bug) and file("hgext/*")' |
|
168 |
hg log -r 'sort(date("May 2008"), user)' |
|
169 |
hg log -r '(keyword(bug) or keyword(issue)) and not ancestors(tagged())' |