Mercurial > hg
comparison mercurial/help/revsets.txt @ 11382:2f09b13e914d
help: new revsets topic
Based on a patch by timeless which in turn is based on
http://selenic.com/pipermail/mercurial-devel/2010-June/021638.html
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Thu, 17 Jun 2010 17:21:39 +0300 |
parents | |
children | a99ef3711890 |
comparison
equal
deleted
inserted
replaced
11381:a4d84792338b | 11382:2f09b13e914d |
---|---|
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 | |
8 quotes if they contain characters outside of ``[a-zA-Z0-9]`` or if | |
9 they match one of the predefined predicates. Special characters can be | |
10 used in the identifiers by quoting them, e.g., ``\n`` is interpreted | |
11 as a newline. | |
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 | |
24 is left out it is equivalent to ``descendents(x)``. | |
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)`` | |
61 The branch names are found for changesets in set, and the result is | |
62 all changesets belonging to one those branches. | |
63 | |
64 ``children(set)`` | |
65 Child changesets of changesets in set. | |
66 | |
67 ``closed()`` | |
68 Changeset is closed. | |
69 | |
70 ``contains(pattern)`` | |
71 Revision contains pattern. | |
72 | |
73 ``date(interval)`` | |
74 Changesets within the interval, see :hg:`help dates`. | |
75 | |
76 ``descendants(set)`` | |
77 Changesets which are decendants of changesets in set. | |
78 | |
79 ``file(pattern)`` | |
80 Changesets which manually affected files matching pattern. | |
81 | |
82 ``follow()`` | |
83 An alias for ``::.`` (ancestors of the working copy's first parent). | |
84 | |
85 ``grep(regex)`` | |
86 Like ``keyword(string)`` but accepts a regex. | |
87 | |
88 ``head()`` | |
89 Changeset is a head. | |
90 | |
91 ``heads(set)`` | |
92 Members of set with no children in set. | |
93 | |
94 ``keyword(string)`` | |
95 Search commit message, user name, and names of changed files for | |
96 string. | |
97 | |
98 ``limit(set, n)`` | |
99 First n members of set. | |
100 | |
101 ``max(set)`` | |
102 Changeset with highest revision number in set. | |
103 | |
104 ``merge()`` | |
105 Changeset is a merge changeset. | |
106 | |
107 ``modifies(pattern)`` | |
108 Changesets which modify files matching pattern. | |
109 | |
110 ``outgoing([path])`` | |
111 Changesets missing in path. | |
112 | |
113 ``p1(set)`` | |
114 First parent of changesets in set. | |
115 | |
116 ``p2(set)`` | |
117 Second parent of changesets in set. | |
118 | |
119 ``parents(set)`` | |
120 The set of all parents for all changesets in set. | |
121 | |
122 ``removes(pattern)`` | |
123 Changesets which remove files matching pattern. | |
124 | |
125 ``reverse(set)`` | |
126 Reverse order of set. | |
127 | |
128 ``roots(set)`` | |
129 Changesets with no parent changeset in set. | |
130 | |
131 ``sort(set[, [-]key...])`` | |
132 Sort set by keys. The default sort order is ascending, specify a key | |
133 as ``-key`` to sort in descending order. | |
134 | |
135 The keys can be: | |
136 | |
137 - ``rev`` for the revision number, | |
138 - ``branch`` for the branch name, | |
139 - ``desc`` for the commit message (description), | |
140 - ``user`` for user name (``author`` can be used as an alias), | |
141 - ``date`` for the commit date | |
142 | |
143 ``tagged()`` | |
144 Changeset is tagged. | |
145 | |
146 ``user(string)`` | |
147 User name is string. | |
148 | |
149 Command line equivalents for :hg:`log`:: | |
150 | |
151 -f -> ::. | |
152 -d x -> date(x) | |
153 -k x -> keyword(x) | |
154 -m -> merge() | |
155 -u x -> user(x) | |
156 -b x -> branch(x) | |
157 -P x -> !::x | |
158 -l x -> limit(expr, x) | |
159 | |
160 Some sample queries:: | |
161 | |
162 hg log -r 'branch(default)' | |
163 hg log -r 'branch(default) and 1.5:: and not merge()' | |
164 hg log -r '1.3::1.5 and keyword(bug) and file("hgext/*")' | |
165 hg log -r 'sort(date("May 2008"), user)' | |
166 hg log -r '(keyword(bug) or keyword(issue)) and not ancestors(tagged())' |