##// END OF EJS Templates
revset: add tests of heads(commonancestors(..))...
Valentin Gatien-Baron -
r39862:84c61c15 stable
parent child Browse files
Show More
@@ -1,2918 +1,2931
1 $ HGENCODING=utf-8
1 $ HGENCODING=utf-8
2 $ export HGENCODING
2 $ export HGENCODING
3 $ cat > testrevset.py << EOF
3 $ cat > testrevset.py << EOF
4 > import mercurial.revset
4 > import mercurial.revset
5 >
5 >
6 > baseset = mercurial.revset.baseset
6 > baseset = mercurial.revset.baseset
7 >
7 >
8 > def r3232(repo, subset, x):
8 > def r3232(repo, subset, x):
9 > """"simple revset that return [3,2,3,2]
9 > """"simple revset that return [3,2,3,2]
10 >
10 >
11 > revisions duplicated on purpose.
11 > revisions duplicated on purpose.
12 > """
12 > """
13 > if 3 not in subset:
13 > if 3 not in subset:
14 > if 2 in subset:
14 > if 2 in subset:
15 > return baseset([2,2])
15 > return baseset([2,2])
16 > return baseset()
16 > return baseset()
17 > return baseset([3,3,2,2])
17 > return baseset([3,3,2,2])
18 >
18 >
19 > mercurial.revset.symbols[b'r3232'] = r3232
19 > mercurial.revset.symbols[b'r3232'] = r3232
20 > EOF
20 > EOF
21 $ cat >> $HGRCPATH << EOF
21 $ cat >> $HGRCPATH << EOF
22 > [extensions]
22 > [extensions]
23 > drawdag=$TESTDIR/drawdag.py
23 > drawdag=$TESTDIR/drawdag.py
24 > testrevset=$TESTTMP/testrevset.py
24 > testrevset=$TESTTMP/testrevset.py
25 > EOF
25 > EOF
26
26
27 $ try() {
27 $ try() {
28 > hg debugrevspec --debug "$@"
28 > hg debugrevspec --debug "$@"
29 > }
29 > }
30
30
31 $ log() {
31 $ log() {
32 > hg log --template '{rev}\n' -r "$1"
32 > hg log --template '{rev}\n' -r "$1"
33 > }
33 > }
34
34
35 extension to build '_intlist()' and '_hexlist()', which is necessary because
35 extension to build '_intlist()' and '_hexlist()', which is necessary because
36 these predicates use '\0' as a separator:
36 these predicates use '\0' as a separator:
37
37
38 $ cat <<EOF > debugrevlistspec.py
38 $ cat <<EOF > debugrevlistspec.py
39 > from __future__ import absolute_import
39 > from __future__ import absolute_import
40 > from mercurial import (
40 > from mercurial import (
41 > node as nodemod,
41 > node as nodemod,
42 > registrar,
42 > registrar,
43 > revset,
43 > revset,
44 > revsetlang,
44 > revsetlang,
45 > )
45 > )
46 > from mercurial.utils import stringutil
46 > from mercurial.utils import stringutil
47 > cmdtable = {}
47 > cmdtable = {}
48 > command = registrar.command(cmdtable)
48 > command = registrar.command(cmdtable)
49 > @command(b'debugrevlistspec',
49 > @command(b'debugrevlistspec',
50 > [(b'', b'optimize', None, b'print parsed tree after optimizing'),
50 > [(b'', b'optimize', None, b'print parsed tree after optimizing'),
51 > (b'', b'bin', None, b'unhexlify arguments')])
51 > (b'', b'bin', None, b'unhexlify arguments')])
52 > def debugrevlistspec(ui, repo, fmt, *args, **opts):
52 > def debugrevlistspec(ui, repo, fmt, *args, **opts):
53 > if opts['bin']:
53 > if opts['bin']:
54 > args = map(nodemod.bin, args)
54 > args = map(nodemod.bin, args)
55 > expr = revsetlang.formatspec(fmt, list(args))
55 > expr = revsetlang.formatspec(fmt, list(args))
56 > if ui.verbose:
56 > if ui.verbose:
57 > tree = revsetlang.parse(expr, lookup=revset.lookupfn(repo))
57 > tree = revsetlang.parse(expr, lookup=revset.lookupfn(repo))
58 > ui.note(revsetlang.prettyformat(tree), b"\n")
58 > ui.note(revsetlang.prettyformat(tree), b"\n")
59 > if opts["optimize"]:
59 > if opts["optimize"]:
60 > opttree = revsetlang.optimize(revsetlang.analyze(tree))
60 > opttree = revsetlang.optimize(revsetlang.analyze(tree))
61 > ui.note(b"* optimized:\n", revsetlang.prettyformat(opttree),
61 > ui.note(b"* optimized:\n", revsetlang.prettyformat(opttree),
62 > b"\n")
62 > b"\n")
63 > func = revset.match(ui, expr, lookup=revset.lookupfn(repo))
63 > func = revset.match(ui, expr, lookup=revset.lookupfn(repo))
64 > revs = func(repo)
64 > revs = func(repo)
65 > if ui.verbose:
65 > if ui.verbose:
66 > ui.note(b"* set:\n", stringutil.prettyrepr(revs), b"\n")
66 > ui.note(b"* set:\n", stringutil.prettyrepr(revs), b"\n")
67 > for c in revs:
67 > for c in revs:
68 > ui.write(b"%d\n" % c)
68 > ui.write(b"%d\n" % c)
69 > EOF
69 > EOF
70 $ cat <<EOF >> $HGRCPATH
70 $ cat <<EOF >> $HGRCPATH
71 > [extensions]
71 > [extensions]
72 > debugrevlistspec = $TESTTMP/debugrevlistspec.py
72 > debugrevlistspec = $TESTTMP/debugrevlistspec.py
73 > EOF
73 > EOF
74 $ trylist() {
74 $ trylist() {
75 > hg debugrevlistspec --debug "$@"
75 > hg debugrevlistspec --debug "$@"
76 > }
76 > }
77
77
78 $ hg init repo
78 $ hg init repo
79 $ cd repo
79 $ cd repo
80
80
81 $ echo a > a
81 $ echo a > a
82 $ hg branch a
82 $ hg branch a
83 marked working directory as branch a
83 marked working directory as branch a
84 (branches are permanent and global, did you want a bookmark?)
84 (branches are permanent and global, did you want a bookmark?)
85 $ hg ci -Aqm0
85 $ hg ci -Aqm0
86
86
87 $ echo b > b
87 $ echo b > b
88 $ hg branch b
88 $ hg branch b
89 marked working directory as branch b
89 marked working directory as branch b
90 $ hg ci -Aqm1
90 $ hg ci -Aqm1
91
91
92 $ rm a
92 $ rm a
93 $ hg branch a-b-c-
93 $ hg branch a-b-c-
94 marked working directory as branch a-b-c-
94 marked working directory as branch a-b-c-
95 $ hg ci -Aqm2 -u Bob
95 $ hg ci -Aqm2 -u Bob
96
96
97 $ hg log -r "extra('branch', 'a-b-c-')" --template '{rev}\n'
97 $ hg log -r "extra('branch', 'a-b-c-')" --template '{rev}\n'
98 2
98 2
99 $ hg log -r "extra('branch')" --template '{rev}\n'
99 $ hg log -r "extra('branch')" --template '{rev}\n'
100 0
100 0
101 1
101 1
102 2
102 2
103 $ hg log -r "extra('branch', 're:a')" --template '{rev} {branch}\n'
103 $ hg log -r "extra('branch', 're:a')" --template '{rev} {branch}\n'
104 0 a
104 0 a
105 2 a-b-c-
105 2 a-b-c-
106
106
107 $ hg co 1
107 $ hg co 1
108 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
108 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
109 $ hg branch +a+b+c+
109 $ hg branch +a+b+c+
110 marked working directory as branch +a+b+c+
110 marked working directory as branch +a+b+c+
111 $ hg ci -Aqm3
111 $ hg ci -Aqm3
112
112
113 $ hg co 2 # interleave
113 $ hg co 2 # interleave
114 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
114 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
115 $ echo bb > b
115 $ echo bb > b
116 $ hg branch -- -a-b-c-
116 $ hg branch -- -a-b-c-
117 marked working directory as branch -a-b-c-
117 marked working directory as branch -a-b-c-
118 $ hg ci -Aqm4 -d "May 12 2005"
118 $ hg ci -Aqm4 -d "May 12 2005"
119
119
120 $ hg co 3
120 $ hg co 3
121 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
121 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
122 $ hg branch !a/b/c/
122 $ hg branch !a/b/c/
123 marked working directory as branch !a/b/c/
123 marked working directory as branch !a/b/c/
124 $ hg ci -Aqm"5 bug"
124 $ hg ci -Aqm"5 bug"
125
125
126 $ hg merge 4
126 $ hg merge 4
127 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
127 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
128 (branch merge, don't forget to commit)
128 (branch merge, don't forget to commit)
129 $ hg branch _a_b_c_
129 $ hg branch _a_b_c_
130 marked working directory as branch _a_b_c_
130 marked working directory as branch _a_b_c_
131 $ hg ci -Aqm"6 issue619"
131 $ hg ci -Aqm"6 issue619"
132
132
133 $ hg branch .a.b.c.
133 $ hg branch .a.b.c.
134 marked working directory as branch .a.b.c.
134 marked working directory as branch .a.b.c.
135 $ hg ci -Aqm7
135 $ hg ci -Aqm7
136
136
137 $ hg branch all
137 $ hg branch all
138 marked working directory as branch all
138 marked working directory as branch all
139
139
140 $ hg co 4
140 $ hg co 4
141 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
141 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
142 $ hg branch Γ©
142 $ hg branch Γ©
143 marked working directory as branch \xc3\xa9 (esc)
143 marked working directory as branch \xc3\xa9 (esc)
144 $ hg ci -Aqm9
144 $ hg ci -Aqm9
145
145
146 $ hg tag -r6 1.0
146 $ hg tag -r6 1.0
147 $ hg bookmark -r6 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
147 $ hg bookmark -r6 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
148
148
149 $ hg clone --quiet -U -r 7 . ../remote1
149 $ hg clone --quiet -U -r 7 . ../remote1
150 $ hg clone --quiet -U -r 8 . ../remote2
150 $ hg clone --quiet -U -r 8 . ../remote2
151 $ echo "[paths]" >> .hg/hgrc
151 $ echo "[paths]" >> .hg/hgrc
152 $ echo "default = ../remote1" >> .hg/hgrc
152 $ echo "default = ../remote1" >> .hg/hgrc
153
153
154 trivial
154 trivial
155
155
156 $ try 0:1
156 $ try 0:1
157 (range
157 (range
158 (symbol '0')
158 (symbol '0')
159 (symbol '1'))
159 (symbol '1'))
160 * set:
160 * set:
161 <spanset+ 0:2>
161 <spanset+ 0:2>
162 0
162 0
163 1
163 1
164 $ try --optimize :
164 $ try --optimize :
165 (rangeall
165 (rangeall
166 None)
166 None)
167 * optimized:
167 * optimized:
168 (rangeall
168 (rangeall
169 None)
169 None)
170 * set:
170 * set:
171 <spanset+ 0:10>
171 <spanset+ 0:10>
172 0
172 0
173 1
173 1
174 2
174 2
175 3
175 3
176 4
176 4
177 5
177 5
178 6
178 6
179 7
179 7
180 8
180 8
181 9
181 9
182 $ try 3::6
182 $ try 3::6
183 (dagrange
183 (dagrange
184 (symbol '3')
184 (symbol '3')
185 (symbol '6'))
185 (symbol '6'))
186 * set:
186 * set:
187 <baseset+ [3, 5, 6]>
187 <baseset+ [3, 5, 6]>
188 3
188 3
189 5
189 5
190 6
190 6
191 $ try '0|1|2'
191 $ try '0|1|2'
192 (or
192 (or
193 (list
193 (list
194 (symbol '0')
194 (symbol '0')
195 (symbol '1')
195 (symbol '1')
196 (symbol '2')))
196 (symbol '2')))
197 * set:
197 * set:
198 <baseset [0, 1, 2]>
198 <baseset [0, 1, 2]>
199 0
199 0
200 1
200 1
201 2
201 2
202
202
203 names that should work without quoting
203 names that should work without quoting
204
204
205 $ try a
205 $ try a
206 (symbol 'a')
206 (symbol 'a')
207 * set:
207 * set:
208 <baseset [0]>
208 <baseset [0]>
209 0
209 0
210 $ try b-a
210 $ try b-a
211 (minus
211 (minus
212 (symbol 'b')
212 (symbol 'b')
213 (symbol 'a'))
213 (symbol 'a'))
214 * set:
214 * set:
215 <filteredset
215 <filteredset
216 <baseset [1]>,
216 <baseset [1]>,
217 <not
217 <not
218 <baseset [0]>>>
218 <baseset [0]>>>
219 1
219 1
220 $ try _a_b_c_
220 $ try _a_b_c_
221 (symbol '_a_b_c_')
221 (symbol '_a_b_c_')
222 * set:
222 * set:
223 <baseset [6]>
223 <baseset [6]>
224 6
224 6
225 $ try _a_b_c_-a
225 $ try _a_b_c_-a
226 (minus
226 (minus
227 (symbol '_a_b_c_')
227 (symbol '_a_b_c_')
228 (symbol 'a'))
228 (symbol 'a'))
229 * set:
229 * set:
230 <filteredset
230 <filteredset
231 <baseset [6]>,
231 <baseset [6]>,
232 <not
232 <not
233 <baseset [0]>>>
233 <baseset [0]>>>
234 6
234 6
235 $ try .a.b.c.
235 $ try .a.b.c.
236 (symbol '.a.b.c.')
236 (symbol '.a.b.c.')
237 * set:
237 * set:
238 <baseset [7]>
238 <baseset [7]>
239 7
239 7
240 $ try .a.b.c.-a
240 $ try .a.b.c.-a
241 (minus
241 (minus
242 (symbol '.a.b.c.')
242 (symbol '.a.b.c.')
243 (symbol 'a'))
243 (symbol 'a'))
244 * set:
244 * set:
245 <filteredset
245 <filteredset
246 <baseset [7]>,
246 <baseset [7]>,
247 <not
247 <not
248 <baseset [0]>>>
248 <baseset [0]>>>
249 7
249 7
250
250
251 names that should be caught by fallback mechanism
251 names that should be caught by fallback mechanism
252
252
253 $ try -- '-a-b-c-'
253 $ try -- '-a-b-c-'
254 (symbol '-a-b-c-')
254 (symbol '-a-b-c-')
255 * set:
255 * set:
256 <baseset [4]>
256 <baseset [4]>
257 4
257 4
258 $ log -a-b-c-
258 $ log -a-b-c-
259 4
259 4
260 $ try '+a+b+c+'
260 $ try '+a+b+c+'
261 (symbol '+a+b+c+')
261 (symbol '+a+b+c+')
262 * set:
262 * set:
263 <baseset [3]>
263 <baseset [3]>
264 3
264 3
265 $ try '+a+b+c+:'
265 $ try '+a+b+c+:'
266 (rangepost
266 (rangepost
267 (symbol '+a+b+c+'))
267 (symbol '+a+b+c+'))
268 * set:
268 * set:
269 <spanset+ 3:10>
269 <spanset+ 3:10>
270 3
270 3
271 4
271 4
272 5
272 5
273 6
273 6
274 7
274 7
275 8
275 8
276 9
276 9
277 $ try ':+a+b+c+'
277 $ try ':+a+b+c+'
278 (rangepre
278 (rangepre
279 (symbol '+a+b+c+'))
279 (symbol '+a+b+c+'))
280 * set:
280 * set:
281 <spanset+ 0:4>
281 <spanset+ 0:4>
282 0
282 0
283 1
283 1
284 2
284 2
285 3
285 3
286 $ try -- '-a-b-c-:+a+b+c+'
286 $ try -- '-a-b-c-:+a+b+c+'
287 (range
287 (range
288 (symbol '-a-b-c-')
288 (symbol '-a-b-c-')
289 (symbol '+a+b+c+'))
289 (symbol '+a+b+c+'))
290 * set:
290 * set:
291 <spanset- 3:5>
291 <spanset- 3:5>
292 4
292 4
293 3
293 3
294 $ log '-a-b-c-:+a+b+c+'
294 $ log '-a-b-c-:+a+b+c+'
295 4
295 4
296 3
296 3
297
297
298 $ try -- -a-b-c--a # complains
298 $ try -- -a-b-c--a # complains
299 (minus
299 (minus
300 (minus
300 (minus
301 (minus
301 (minus
302 (negate
302 (negate
303 (symbol 'a'))
303 (symbol 'a'))
304 (symbol 'b'))
304 (symbol 'b'))
305 (symbol 'c'))
305 (symbol 'c'))
306 (negate
306 (negate
307 (symbol 'a')))
307 (symbol 'a')))
308 abort: unknown revision '-a'!
308 abort: unknown revision '-a'!
309 [255]
309 [255]
310 $ try Γ©
310 $ try Γ©
311 (symbol '\xc3\xa9')
311 (symbol '\xc3\xa9')
312 * set:
312 * set:
313 <baseset [9]>
313 <baseset [9]>
314 9
314 9
315
315
316 no quoting needed
316 no quoting needed
317
317
318 $ log ::a-b-c-
318 $ log ::a-b-c-
319 0
319 0
320 1
320 1
321 2
321 2
322
322
323 quoting needed
323 quoting needed
324
324
325 $ try '"-a-b-c-"-a'
325 $ try '"-a-b-c-"-a'
326 (minus
326 (minus
327 (string '-a-b-c-')
327 (string '-a-b-c-')
328 (symbol 'a'))
328 (symbol 'a'))
329 * set:
329 * set:
330 <filteredset
330 <filteredset
331 <baseset [4]>,
331 <baseset [4]>,
332 <not
332 <not
333 <baseset [0]>>>
333 <baseset [0]>>>
334 4
334 4
335
335
336 $ log '1 or 2'
336 $ log '1 or 2'
337 1
337 1
338 2
338 2
339 $ log '1|2'
339 $ log '1|2'
340 1
340 1
341 2
341 2
342 $ log '1 and 2'
342 $ log '1 and 2'
343 $ log '1&2'
343 $ log '1&2'
344 $ try '1&2|3' # precedence - and is higher
344 $ try '1&2|3' # precedence - and is higher
345 (or
345 (or
346 (list
346 (list
347 (and
347 (and
348 (symbol '1')
348 (symbol '1')
349 (symbol '2'))
349 (symbol '2'))
350 (symbol '3')))
350 (symbol '3')))
351 * set:
351 * set:
352 <addset
352 <addset
353 <baseset []>,
353 <baseset []>,
354 <baseset [3]>>
354 <baseset [3]>>
355 3
355 3
356 $ try '1|2&3'
356 $ try '1|2&3'
357 (or
357 (or
358 (list
358 (list
359 (symbol '1')
359 (symbol '1')
360 (and
360 (and
361 (symbol '2')
361 (symbol '2')
362 (symbol '3'))))
362 (symbol '3'))))
363 * set:
363 * set:
364 <addset
364 <addset
365 <baseset [1]>,
365 <baseset [1]>,
366 <baseset []>>
366 <baseset []>>
367 1
367 1
368 $ try '1&2&3' # associativity
368 $ try '1&2&3' # associativity
369 (and
369 (and
370 (and
370 (and
371 (symbol '1')
371 (symbol '1')
372 (symbol '2'))
372 (symbol '2'))
373 (symbol '3'))
373 (symbol '3'))
374 * set:
374 * set:
375 <baseset []>
375 <baseset []>
376 $ try '1|(2|3)'
376 $ try '1|(2|3)'
377 (or
377 (or
378 (list
378 (list
379 (symbol '1')
379 (symbol '1')
380 (group
380 (group
381 (or
381 (or
382 (list
382 (list
383 (symbol '2')
383 (symbol '2')
384 (symbol '3'))))))
384 (symbol '3'))))))
385 * set:
385 * set:
386 <addset
386 <addset
387 <baseset [1]>,
387 <baseset [1]>,
388 <baseset [2, 3]>>
388 <baseset [2, 3]>>
389 1
389 1
390 2
390 2
391 3
391 3
392 $ log '1.0' # tag
392 $ log '1.0' # tag
393 6
393 6
394 $ log 'a' # branch
394 $ log 'a' # branch
395 0
395 0
396 $ log '2785f51ee'
396 $ log '2785f51ee'
397 0
397 0
398 $ log 'date(2005)'
398 $ log 'date(2005)'
399 4
399 4
400 $ log 'date(this is a test)'
400 $ log 'date(this is a test)'
401 hg: parse error at 10: unexpected token: symbol
401 hg: parse error at 10: unexpected token: symbol
402 (date(this is a test)
402 (date(this is a test)
403 ^ here)
403 ^ here)
404 [255]
404 [255]
405 $ log 'date()'
405 $ log 'date()'
406 hg: parse error: date requires a string
406 hg: parse error: date requires a string
407 [255]
407 [255]
408 $ log 'date'
408 $ log 'date'
409 abort: unknown revision 'date'!
409 abort: unknown revision 'date'!
410 [255]
410 [255]
411 $ log 'date('
411 $ log 'date('
412 hg: parse error at 5: not a prefix: end
412 hg: parse error at 5: not a prefix: end
413 (date(
413 (date(
414 ^ here)
414 ^ here)
415 [255]
415 [255]
416 $ log 'date("\xy")'
416 $ log 'date("\xy")'
417 hg: parse error: invalid \x escape* (glob)
417 hg: parse error: invalid \x escape* (glob)
418 [255]
418 [255]
419 $ log 'date(tip)'
419 $ log 'date(tip)'
420 hg: parse error: invalid date: 'tip'
420 hg: parse error: invalid date: 'tip'
421 [255]
421 [255]
422 $ log '0:date'
422 $ log '0:date'
423 abort: unknown revision 'date'!
423 abort: unknown revision 'date'!
424 [255]
424 [255]
425 $ log '::"date"'
425 $ log '::"date"'
426 abort: unknown revision 'date'!
426 abort: unknown revision 'date'!
427 [255]
427 [255]
428 $ hg book date -r 4
428 $ hg book date -r 4
429 $ log '0:date'
429 $ log '0:date'
430 0
430 0
431 1
431 1
432 2
432 2
433 3
433 3
434 4
434 4
435 $ log '::date'
435 $ log '::date'
436 0
436 0
437 1
437 1
438 2
438 2
439 4
439 4
440 $ log '::"date"'
440 $ log '::"date"'
441 0
441 0
442 1
442 1
443 2
443 2
444 4
444 4
445 $ log 'date(2005) and 1::'
445 $ log 'date(2005) and 1::'
446 4
446 4
447 $ hg book -d date
447 $ hg book -d date
448
448
449 function name should be a symbol
449 function name should be a symbol
450
450
451 $ log '"date"(2005)'
451 $ log '"date"(2005)'
452 hg: parse error: not a symbol
452 hg: parse error: not a symbol
453 [255]
453 [255]
454
454
455 keyword arguments
455 keyword arguments
456
456
457 $ log 'extra(branch, value=a)'
457 $ log 'extra(branch, value=a)'
458 0
458 0
459
459
460 $ log 'extra(branch, a, b)'
460 $ log 'extra(branch, a, b)'
461 hg: parse error: extra takes at most 2 positional arguments
461 hg: parse error: extra takes at most 2 positional arguments
462 [255]
462 [255]
463 $ log 'extra(a, label=b)'
463 $ log 'extra(a, label=b)'
464 hg: parse error: extra got multiple values for keyword argument 'label'
464 hg: parse error: extra got multiple values for keyword argument 'label'
465 [255]
465 [255]
466 $ log 'extra(label=branch, default)'
466 $ log 'extra(label=branch, default)'
467 hg: parse error: extra got an invalid argument
467 hg: parse error: extra got an invalid argument
468 [255]
468 [255]
469 $ log 'extra(branch, foo+bar=baz)'
469 $ log 'extra(branch, foo+bar=baz)'
470 hg: parse error: extra got an invalid argument
470 hg: parse error: extra got an invalid argument
471 [255]
471 [255]
472 $ log 'extra(unknown=branch)'
472 $ log 'extra(unknown=branch)'
473 hg: parse error: extra got an unexpected keyword argument 'unknown'
473 hg: parse error: extra got an unexpected keyword argument 'unknown'
474 [255]
474 [255]
475
475
476 $ try 'foo=bar|baz'
476 $ try 'foo=bar|baz'
477 (keyvalue
477 (keyvalue
478 (symbol 'foo')
478 (symbol 'foo')
479 (or
479 (or
480 (list
480 (list
481 (symbol 'bar')
481 (symbol 'bar')
482 (symbol 'baz'))))
482 (symbol 'baz'))))
483 hg: parse error: can't use a key-value pair in this context
483 hg: parse error: can't use a key-value pair in this context
484 [255]
484 [255]
485
485
486 right-hand side should be optimized recursively
486 right-hand side should be optimized recursively
487
487
488 $ try --optimize 'foo=(not public())'
488 $ try --optimize 'foo=(not public())'
489 (keyvalue
489 (keyvalue
490 (symbol 'foo')
490 (symbol 'foo')
491 (group
491 (group
492 (not
492 (not
493 (func
493 (func
494 (symbol 'public')
494 (symbol 'public')
495 None))))
495 None))))
496 * optimized:
496 * optimized:
497 (keyvalue
497 (keyvalue
498 (symbol 'foo')
498 (symbol 'foo')
499 (func
499 (func
500 (symbol '_notpublic')
500 (symbol '_notpublic')
501 None))
501 None))
502 hg: parse error: can't use a key-value pair in this context
502 hg: parse error: can't use a key-value pair in this context
503 [255]
503 [255]
504
504
505 relation-subscript operator has the highest binding strength (as function call):
505 relation-subscript operator has the highest binding strength (as function call):
506
506
507 $ hg debugrevspec -p parsed 'tip:tip^#generations[-1]'
507 $ hg debugrevspec -p parsed 'tip:tip^#generations[-1]'
508 * parsed:
508 * parsed:
509 (range
509 (range
510 (symbol 'tip')
510 (symbol 'tip')
511 (relsubscript
511 (relsubscript
512 (parentpost
512 (parentpost
513 (symbol 'tip'))
513 (symbol 'tip'))
514 (symbol 'generations')
514 (symbol 'generations')
515 (negate
515 (negate
516 (symbol '1'))))
516 (symbol '1'))))
517 9
517 9
518 8
518 8
519 7
519 7
520 6
520 6
521 5
521 5
522 4
522 4
523
523
524 $ hg debugrevspec -p parsed --no-show-revs 'not public()#generations[0]'
524 $ hg debugrevspec -p parsed --no-show-revs 'not public()#generations[0]'
525 * parsed:
525 * parsed:
526 (not
526 (not
527 (relsubscript
527 (relsubscript
528 (func
528 (func
529 (symbol 'public')
529 (symbol 'public')
530 None)
530 None)
531 (symbol 'generations')
531 (symbol 'generations')
532 (symbol '0')))
532 (symbol '0')))
533
533
534 left-hand side of relation-subscript operator should be optimized recursively:
534 left-hand side of relation-subscript operator should be optimized recursively:
535
535
536 $ hg debugrevspec -p analyzed -p optimized --no-show-revs \
536 $ hg debugrevspec -p analyzed -p optimized --no-show-revs \
537 > '(not public())#generations[0]'
537 > '(not public())#generations[0]'
538 * analyzed:
538 * analyzed:
539 (relsubscript
539 (relsubscript
540 (not
540 (not
541 (func
541 (func
542 (symbol 'public')
542 (symbol 'public')
543 None))
543 None))
544 (symbol 'generations')
544 (symbol 'generations')
545 (symbol '0'))
545 (symbol '0'))
546 * optimized:
546 * optimized:
547 (relsubscript
547 (relsubscript
548 (func
548 (func
549 (symbol '_notpublic')
549 (symbol '_notpublic')
550 None)
550 None)
551 (symbol 'generations')
551 (symbol 'generations')
552 (symbol '0'))
552 (symbol '0'))
553
553
554 resolution of subscript and relation-subscript ternary operators:
554 resolution of subscript and relation-subscript ternary operators:
555
555
556 $ hg debugrevspec -p analyzed 'tip[0]'
556 $ hg debugrevspec -p analyzed 'tip[0]'
557 * analyzed:
557 * analyzed:
558 (subscript
558 (subscript
559 (symbol 'tip')
559 (symbol 'tip')
560 (symbol '0'))
560 (symbol '0'))
561 hg: parse error: can't use a subscript in this context
561 hg: parse error: can't use a subscript in this context
562 [255]
562 [255]
563
563
564 $ hg debugrevspec -p analyzed 'tip#rel[0]'
564 $ hg debugrevspec -p analyzed 'tip#rel[0]'
565 * analyzed:
565 * analyzed:
566 (relsubscript
566 (relsubscript
567 (symbol 'tip')
567 (symbol 'tip')
568 (symbol 'rel')
568 (symbol 'rel')
569 (symbol '0'))
569 (symbol '0'))
570 hg: parse error: unknown identifier: rel
570 hg: parse error: unknown identifier: rel
571 [255]
571 [255]
572
572
573 $ hg debugrevspec -p analyzed '(tip#rel)[0]'
573 $ hg debugrevspec -p analyzed '(tip#rel)[0]'
574 * analyzed:
574 * analyzed:
575 (subscript
575 (subscript
576 (relation
576 (relation
577 (symbol 'tip')
577 (symbol 'tip')
578 (symbol 'rel'))
578 (symbol 'rel'))
579 (symbol '0'))
579 (symbol '0'))
580 hg: parse error: can't use a subscript in this context
580 hg: parse error: can't use a subscript in this context
581 [255]
581 [255]
582
582
583 $ hg debugrevspec -p analyzed 'tip#rel[0][1]'
583 $ hg debugrevspec -p analyzed 'tip#rel[0][1]'
584 * analyzed:
584 * analyzed:
585 (subscript
585 (subscript
586 (relsubscript
586 (relsubscript
587 (symbol 'tip')
587 (symbol 'tip')
588 (symbol 'rel')
588 (symbol 'rel')
589 (symbol '0'))
589 (symbol '0'))
590 (symbol '1'))
590 (symbol '1'))
591 hg: parse error: can't use a subscript in this context
591 hg: parse error: can't use a subscript in this context
592 [255]
592 [255]
593
593
594 $ hg debugrevspec -p analyzed 'tip#rel0#rel1[1]'
594 $ hg debugrevspec -p analyzed 'tip#rel0#rel1[1]'
595 * analyzed:
595 * analyzed:
596 (relsubscript
596 (relsubscript
597 (relation
597 (relation
598 (symbol 'tip')
598 (symbol 'tip')
599 (symbol 'rel0'))
599 (symbol 'rel0'))
600 (symbol 'rel1')
600 (symbol 'rel1')
601 (symbol '1'))
601 (symbol '1'))
602 hg: parse error: unknown identifier: rel1
602 hg: parse error: unknown identifier: rel1
603 [255]
603 [255]
604
604
605 $ hg debugrevspec -p analyzed 'tip#rel0[0]#rel1[1]'
605 $ hg debugrevspec -p analyzed 'tip#rel0[0]#rel1[1]'
606 * analyzed:
606 * analyzed:
607 (relsubscript
607 (relsubscript
608 (relsubscript
608 (relsubscript
609 (symbol 'tip')
609 (symbol 'tip')
610 (symbol 'rel0')
610 (symbol 'rel0')
611 (symbol '0'))
611 (symbol '0'))
612 (symbol 'rel1')
612 (symbol 'rel1')
613 (symbol '1'))
613 (symbol '1'))
614 hg: parse error: unknown identifier: rel1
614 hg: parse error: unknown identifier: rel1
615 [255]
615 [255]
616
616
617 parse errors of relation, subscript and relation-subscript operators:
617 parse errors of relation, subscript and relation-subscript operators:
618
618
619 $ hg debugrevspec '[0]'
619 $ hg debugrevspec '[0]'
620 hg: parse error at 0: not a prefix: [
620 hg: parse error at 0: not a prefix: [
621 ([0]
621 ([0]
622 ^ here)
622 ^ here)
623 [255]
623 [255]
624 $ hg debugrevspec '.#'
624 $ hg debugrevspec '.#'
625 hg: parse error at 2: not a prefix: end
625 hg: parse error at 2: not a prefix: end
626 (.#
626 (.#
627 ^ here)
627 ^ here)
628 [255]
628 [255]
629 $ hg debugrevspec '#rel'
629 $ hg debugrevspec '#rel'
630 hg: parse error at 0: not a prefix: #
630 hg: parse error at 0: not a prefix: #
631 (#rel
631 (#rel
632 ^ here)
632 ^ here)
633 [255]
633 [255]
634 $ hg debugrevspec '.#rel[0'
634 $ hg debugrevspec '.#rel[0'
635 hg: parse error at 7: unexpected token: end
635 hg: parse error at 7: unexpected token: end
636 (.#rel[0
636 (.#rel[0
637 ^ here)
637 ^ here)
638 [255]
638 [255]
639 $ hg debugrevspec '.]'
639 $ hg debugrevspec '.]'
640 hg: parse error at 1: invalid token
640 hg: parse error at 1: invalid token
641 (.]
641 (.]
642 ^ here)
642 ^ here)
643 [255]
643 [255]
644
644
645 $ hg debugrevspec '.#generations[a]'
645 $ hg debugrevspec '.#generations[a]'
646 hg: parse error: relation subscript must be an integer
646 hg: parse error: relation subscript must be an integer
647 [255]
647 [255]
648 $ hg debugrevspec '.#generations[1-2]'
648 $ hg debugrevspec '.#generations[1-2]'
649 hg: parse error: relation subscript must be an integer
649 hg: parse error: relation subscript must be an integer
650 [255]
650 [255]
651
651
652 parsed tree at stages:
652 parsed tree at stages:
653
653
654 $ hg debugrevspec -p all '()'
654 $ hg debugrevspec -p all '()'
655 * parsed:
655 * parsed:
656 (group
656 (group
657 None)
657 None)
658 * expanded:
658 * expanded:
659 (group
659 (group
660 None)
660 None)
661 * concatenated:
661 * concatenated:
662 (group
662 (group
663 None)
663 None)
664 * analyzed:
664 * analyzed:
665 None
665 None
666 * optimized:
666 * optimized:
667 None
667 None
668 hg: parse error: missing argument
668 hg: parse error: missing argument
669 [255]
669 [255]
670
670
671 $ hg debugrevspec --no-optimized -p all '()'
671 $ hg debugrevspec --no-optimized -p all '()'
672 * parsed:
672 * parsed:
673 (group
673 (group
674 None)
674 None)
675 * expanded:
675 * expanded:
676 (group
676 (group
677 None)
677 None)
678 * concatenated:
678 * concatenated:
679 (group
679 (group
680 None)
680 None)
681 * analyzed:
681 * analyzed:
682 None
682 None
683 hg: parse error: missing argument
683 hg: parse error: missing argument
684 [255]
684 [255]
685
685
686 $ hg debugrevspec -p parsed -p analyzed -p optimized '(0|1)-1'
686 $ hg debugrevspec -p parsed -p analyzed -p optimized '(0|1)-1'
687 * parsed:
687 * parsed:
688 (minus
688 (minus
689 (group
689 (group
690 (or
690 (or
691 (list
691 (list
692 (symbol '0')
692 (symbol '0')
693 (symbol '1'))))
693 (symbol '1'))))
694 (symbol '1'))
694 (symbol '1'))
695 * analyzed:
695 * analyzed:
696 (and
696 (and
697 (or
697 (or
698 (list
698 (list
699 (symbol '0')
699 (symbol '0')
700 (symbol '1')))
700 (symbol '1')))
701 (not
701 (not
702 (symbol '1')))
702 (symbol '1')))
703 * optimized:
703 * optimized:
704 (difference
704 (difference
705 (func
705 (func
706 (symbol '_list')
706 (symbol '_list')
707 (string '0\x001'))
707 (string '0\x001'))
708 (symbol '1'))
708 (symbol '1'))
709 0
709 0
710
710
711 $ hg debugrevspec -p unknown '0'
711 $ hg debugrevspec -p unknown '0'
712 abort: invalid stage name: unknown
712 abort: invalid stage name: unknown
713 [255]
713 [255]
714
714
715 $ hg debugrevspec -p all --optimize '0'
715 $ hg debugrevspec -p all --optimize '0'
716 abort: cannot use --optimize with --show-stage
716 abort: cannot use --optimize with --show-stage
717 [255]
717 [255]
718
718
719 verify optimized tree:
719 verify optimized tree:
720
720
721 $ hg debugrevspec --verify '0|1'
721 $ hg debugrevspec --verify '0|1'
722
722
723 $ hg debugrevspec --verify -v -p analyzed -p optimized 'r3232() & 2'
723 $ hg debugrevspec --verify -v -p analyzed -p optimized 'r3232() & 2'
724 * analyzed:
724 * analyzed:
725 (and
725 (and
726 (func
726 (func
727 (symbol 'r3232')
727 (symbol 'r3232')
728 None)
728 None)
729 (symbol '2'))
729 (symbol '2'))
730 * optimized:
730 * optimized:
731 (andsmally
731 (andsmally
732 (func
732 (func
733 (symbol 'r3232')
733 (symbol 'r3232')
734 None)
734 None)
735 (symbol '2'))
735 (symbol '2'))
736 * analyzed set:
736 * analyzed set:
737 <baseset [2]>
737 <baseset [2]>
738 * optimized set:
738 * optimized set:
739 <baseset [2, 2]>
739 <baseset [2, 2]>
740 --- analyzed
740 --- analyzed
741 +++ optimized
741 +++ optimized
742 2
742 2
743 +2
743 +2
744 [1]
744 [1]
745
745
746 $ hg debugrevspec --no-optimized --verify-optimized '0'
746 $ hg debugrevspec --no-optimized --verify-optimized '0'
747 abort: cannot use --verify-optimized with --no-optimized
747 abort: cannot use --verify-optimized with --no-optimized
748 [255]
748 [255]
749
749
750 Test that symbols only get parsed as functions if there's an opening
750 Test that symbols only get parsed as functions if there's an opening
751 parenthesis.
751 parenthesis.
752
752
753 $ hg book only -r 9
753 $ hg book only -r 9
754 $ log 'only(only)' # Outer "only" is a function, inner "only" is the bookmark
754 $ log 'only(only)' # Outer "only" is a function, inner "only" is the bookmark
755 8
755 8
756 9
756 9
757
757
758 ':y' behaves like '0:y', but can't be rewritten as such since the revision '0'
758 ':y' behaves like '0:y', but can't be rewritten as such since the revision '0'
759 may be hidden (issue5385)
759 may be hidden (issue5385)
760
760
761 $ try -p parsed -p analyzed ':'
761 $ try -p parsed -p analyzed ':'
762 * parsed:
762 * parsed:
763 (rangeall
763 (rangeall
764 None)
764 None)
765 * analyzed:
765 * analyzed:
766 (rangeall
766 (rangeall
767 None)
767 None)
768 * set:
768 * set:
769 <spanset+ 0:10>
769 <spanset+ 0:10>
770 0
770 0
771 1
771 1
772 2
772 2
773 3
773 3
774 4
774 4
775 5
775 5
776 6
776 6
777 7
777 7
778 8
778 8
779 9
779 9
780 $ try -p analyzed ':1'
780 $ try -p analyzed ':1'
781 * analyzed:
781 * analyzed:
782 (rangepre
782 (rangepre
783 (symbol '1'))
783 (symbol '1'))
784 * set:
784 * set:
785 <spanset+ 0:2>
785 <spanset+ 0:2>
786 0
786 0
787 1
787 1
788 $ try -p analyzed ':(1|2)'
788 $ try -p analyzed ':(1|2)'
789 * analyzed:
789 * analyzed:
790 (rangepre
790 (rangepre
791 (or
791 (or
792 (list
792 (list
793 (symbol '1')
793 (symbol '1')
794 (symbol '2'))))
794 (symbol '2'))))
795 * set:
795 * set:
796 <spanset+ 0:3>
796 <spanset+ 0:3>
797 0
797 0
798 1
798 1
799 2
799 2
800 $ try -p analyzed ':(1&2)'
800 $ try -p analyzed ':(1&2)'
801 * analyzed:
801 * analyzed:
802 (rangepre
802 (rangepre
803 (and
803 (and
804 (symbol '1')
804 (symbol '1')
805 (symbol '2')))
805 (symbol '2')))
806 * set:
806 * set:
807 <baseset []>
807 <baseset []>
808
808
809 infix/suffix resolution of ^ operator (issue2884, issue5764):
809 infix/suffix resolution of ^ operator (issue2884, issue5764):
810
810
811 x^:y means (x^):y
811 x^:y means (x^):y
812
812
813 $ try '1^:2'
813 $ try '1^:2'
814 (range
814 (range
815 (parentpost
815 (parentpost
816 (symbol '1'))
816 (symbol '1'))
817 (symbol '2'))
817 (symbol '2'))
818 * set:
818 * set:
819 <spanset+ 0:3>
819 <spanset+ 0:3>
820 0
820 0
821 1
821 1
822 2
822 2
823
823
824 $ try '1^::2'
824 $ try '1^::2'
825 (dagrange
825 (dagrange
826 (parentpost
826 (parentpost
827 (symbol '1'))
827 (symbol '1'))
828 (symbol '2'))
828 (symbol '2'))
829 * set:
829 * set:
830 <baseset+ [0, 1, 2]>
830 <baseset+ [0, 1, 2]>
831 0
831 0
832 1
832 1
833 2
833 2
834
834
835 $ try '1^..2'
835 $ try '1^..2'
836 (dagrange
836 (dagrange
837 (parentpost
837 (parentpost
838 (symbol '1'))
838 (symbol '1'))
839 (symbol '2'))
839 (symbol '2'))
840 * set:
840 * set:
841 <baseset+ [0, 1, 2]>
841 <baseset+ [0, 1, 2]>
842 0
842 0
843 1
843 1
844 2
844 2
845
845
846 $ try '9^:'
846 $ try '9^:'
847 (rangepost
847 (rangepost
848 (parentpost
848 (parentpost
849 (symbol '9')))
849 (symbol '9')))
850 * set:
850 * set:
851 <spanset+ 8:10>
851 <spanset+ 8:10>
852 8
852 8
853 9
853 9
854
854
855 $ try '9^::'
855 $ try '9^::'
856 (dagrangepost
856 (dagrangepost
857 (parentpost
857 (parentpost
858 (symbol '9')))
858 (symbol '9')))
859 * set:
859 * set:
860 <generatorsetasc+>
860 <generatorsetasc+>
861 8
861 8
862 9
862 9
863
863
864 $ try '9^..'
864 $ try '9^..'
865 (dagrangepost
865 (dagrangepost
866 (parentpost
866 (parentpost
867 (symbol '9')))
867 (symbol '9')))
868 * set:
868 * set:
869 <generatorsetasc+>
869 <generatorsetasc+>
870 8
870 8
871 9
871 9
872
872
873 x^:y should be resolved before omitting group operators
873 x^:y should be resolved before omitting group operators
874
874
875 $ try '1^(:2)'
875 $ try '1^(:2)'
876 (parent
876 (parent
877 (symbol '1')
877 (symbol '1')
878 (group
878 (group
879 (rangepre
879 (rangepre
880 (symbol '2'))))
880 (symbol '2'))))
881 hg: parse error: ^ expects a number 0, 1, or 2
881 hg: parse error: ^ expects a number 0, 1, or 2
882 [255]
882 [255]
883
883
884 x^:y should be resolved recursively
884 x^:y should be resolved recursively
885
885
886 $ try 'sort(1^:2)'
886 $ try 'sort(1^:2)'
887 (func
887 (func
888 (symbol 'sort')
888 (symbol 'sort')
889 (range
889 (range
890 (parentpost
890 (parentpost
891 (symbol '1'))
891 (symbol '1'))
892 (symbol '2')))
892 (symbol '2')))
893 * set:
893 * set:
894 <spanset+ 0:3>
894 <spanset+ 0:3>
895 0
895 0
896 1
896 1
897 2
897 2
898
898
899 $ try '(3^:4)^:2'
899 $ try '(3^:4)^:2'
900 (range
900 (range
901 (parentpost
901 (parentpost
902 (group
902 (group
903 (range
903 (range
904 (parentpost
904 (parentpost
905 (symbol '3'))
905 (symbol '3'))
906 (symbol '4'))))
906 (symbol '4'))))
907 (symbol '2'))
907 (symbol '2'))
908 * set:
908 * set:
909 <spanset+ 0:3>
909 <spanset+ 0:3>
910 0
910 0
911 1
911 1
912 2
912 2
913
913
914 $ try '(3^::4)^::2'
914 $ try '(3^::4)^::2'
915 (dagrange
915 (dagrange
916 (parentpost
916 (parentpost
917 (group
917 (group
918 (dagrange
918 (dagrange
919 (parentpost
919 (parentpost
920 (symbol '3'))
920 (symbol '3'))
921 (symbol '4'))))
921 (symbol '4'))))
922 (symbol '2'))
922 (symbol '2'))
923 * set:
923 * set:
924 <baseset+ [0, 1, 2]>
924 <baseset+ [0, 1, 2]>
925 0
925 0
926 1
926 1
927 2
927 2
928
928
929 $ try '(9^:)^:'
929 $ try '(9^:)^:'
930 (rangepost
930 (rangepost
931 (parentpost
931 (parentpost
932 (group
932 (group
933 (rangepost
933 (rangepost
934 (parentpost
934 (parentpost
935 (symbol '9'))))))
935 (symbol '9'))))))
936 * set:
936 * set:
937 <spanset+ 4:10>
937 <spanset+ 4:10>
938 4
938 4
939 5
939 5
940 6
940 6
941 7
941 7
942 8
942 8
943 9
943 9
944
944
945 x^ in alias should also be resolved
945 x^ in alias should also be resolved
946
946
947 $ try 'A' --config 'revsetalias.A=1^:2'
947 $ try 'A' --config 'revsetalias.A=1^:2'
948 (symbol 'A')
948 (symbol 'A')
949 * expanded:
949 * expanded:
950 (range
950 (range
951 (parentpost
951 (parentpost
952 (symbol '1'))
952 (symbol '1'))
953 (symbol '2'))
953 (symbol '2'))
954 * set:
954 * set:
955 <spanset+ 0:3>
955 <spanset+ 0:3>
956 0
956 0
957 1
957 1
958 2
958 2
959
959
960 $ try 'A:2' --config 'revsetalias.A=1^'
960 $ try 'A:2' --config 'revsetalias.A=1^'
961 (range
961 (range
962 (symbol 'A')
962 (symbol 'A')
963 (symbol '2'))
963 (symbol '2'))
964 * expanded:
964 * expanded:
965 (range
965 (range
966 (parentpost
966 (parentpost
967 (symbol '1'))
967 (symbol '1'))
968 (symbol '2'))
968 (symbol '2'))
969 * set:
969 * set:
970 <spanset+ 0:3>
970 <spanset+ 0:3>
971 0
971 0
972 1
972 1
973 2
973 2
974
974
975 but not beyond the boundary of alias expansion, because the resolution should
975 but not beyond the boundary of alias expansion, because the resolution should
976 be made at the parsing stage
976 be made at the parsing stage
977
977
978 $ try '1^A' --config 'revsetalias.A=:2'
978 $ try '1^A' --config 'revsetalias.A=:2'
979 (parent
979 (parent
980 (symbol '1')
980 (symbol '1')
981 (symbol 'A'))
981 (symbol 'A'))
982 * expanded:
982 * expanded:
983 (parent
983 (parent
984 (symbol '1')
984 (symbol '1')
985 (rangepre
985 (rangepre
986 (symbol '2')))
986 (symbol '2')))
987 hg: parse error: ^ expects a number 0, 1, or 2
987 hg: parse error: ^ expects a number 0, 1, or 2
988 [255]
988 [255]
989
989
990 '::' itself isn't a valid expression
990 '::' itself isn't a valid expression
991
991
992 $ try '::'
992 $ try '::'
993 (dagrangeall
993 (dagrangeall
994 None)
994 None)
995 hg: parse error: can't use '::' in this context
995 hg: parse error: can't use '::' in this context
996 [255]
996 [255]
997
997
998 ancestor can accept 0 or more arguments
998 ancestor can accept 0 or more arguments
999
999
1000 $ log 'ancestor()'
1000 $ log 'ancestor()'
1001 $ log 'ancestor(1)'
1001 $ log 'ancestor(1)'
1002 1
1002 1
1003 $ log 'ancestor(4,5)'
1003 $ log 'ancestor(4,5)'
1004 1
1004 1
1005 $ log 'ancestor(4,5) and 4'
1005 $ log 'ancestor(4,5) and 4'
1006 $ log 'ancestor(0,0,1,3)'
1006 $ log 'ancestor(0,0,1,3)'
1007 0
1007 0
1008 $ log 'ancestor(3,1,5,3,5,1)'
1008 $ log 'ancestor(3,1,5,3,5,1)'
1009 1
1009 1
1010 $ log 'ancestor(0,1,3,5)'
1010 $ log 'ancestor(0,1,3,5)'
1011 0
1011 0
1012 $ log 'ancestor(1,2,3,4,5)'
1012 $ log 'ancestor(1,2,3,4,5)'
1013 1
1013 1
1014
1014
1015 test ancestors
1015 test ancestors
1016
1016
1017 $ hg log -G -T '{rev}\n' --config experimental.graphshorten=True
1017 $ hg log -G -T '{rev}\n' --config experimental.graphshorten=True
1018 @ 9
1018 @ 9
1019 o 8
1019 o 8
1020 | o 7
1020 | o 7
1021 | o 6
1021 | o 6
1022 |/|
1022 |/|
1023 | o 5
1023 | o 5
1024 o | 4
1024 o | 4
1025 | o 3
1025 | o 3
1026 o | 2
1026 o | 2
1027 |/
1027 |/
1028 o 1
1028 o 1
1029 o 0
1029 o 0
1030
1030
1031 $ log 'ancestors(5)'
1031 $ log 'ancestors(5)'
1032 0
1032 0
1033 1
1033 1
1034 3
1034 3
1035 5
1035 5
1036 $ log 'ancestor(ancestors(5))'
1036 $ log 'ancestor(ancestors(5))'
1037 0
1037 0
1038 $ log '::r3232()'
1038 $ log '::r3232()'
1039 0
1039 0
1040 1
1040 1
1041 2
1041 2
1042 3
1042 3
1043
1043
1044 test common ancestors
1044 test common ancestors
1045
1045
1046 $ hg log -T '{rev}\n' -r 'commonancestors(7 + 9)'
1046 $ hg log -T '{rev}\n' -r 'commonancestors(7 + 9)'
1047 0
1047 0
1048 1
1048 1
1049 2
1049 2
1050 4
1050 4
1051
1051
1052 $ hg log -T '{rev}\n' -r 'commonancestors(heads(all()))'
1052 $ hg log -T '{rev}\n' -r 'commonancestors(heads(all()))'
1053 0
1053 0
1054 1
1054 1
1055 2
1055 2
1056 4
1056 4
1057
1057
1058 $ hg log -T '{rev}\n' -r 'commonancestors(9)'
1058 $ hg log -T '{rev}\n' -r 'commonancestors(9)'
1059 0
1059 0
1060 1
1060 1
1061 2
1061 2
1062 4
1062 4
1063 8
1063 8
1064 9
1064 9
1065
1065
1066 $ hg log -T '{rev}\n' -r 'commonancestors(8 + 9)'
1066 $ hg log -T '{rev}\n' -r 'commonancestors(8 + 9)'
1067 0
1067 0
1068 1
1068 1
1069 2
1069 2
1070 4
1070 4
1071 8
1071 8
1072
1072
1073 test the specialized implementation of heads(commonancestors(..))
1074 (2 gcas is tested in test-merge-criss-cross.t)
1075
1076 $ hg log -T '{rev}\n' -r 'heads(commonancestors(7 + 9))'
1077 4
1078 $ hg log -T '{rev}\n' -r 'heads(commonancestors(heads(all())))'
1079 4
1080 $ hg log -T '{rev}\n' -r 'heads(commonancestors(9))'
1081 9
1082 $ hg log -T '{rev}\n' -r 'heads(commonancestors(8 + 9))'
1083 9
1084
1073 test ancestor variants of empty revision
1085 test ancestor variants of empty revision
1074
1086
1075 $ log 'ancestor(none())'
1087 $ log 'ancestor(none())'
1076 $ log 'ancestors(none())'
1088 $ log 'ancestors(none())'
1077 $ log 'commonancestors(none())'
1089 $ log 'commonancestors(none())'
1090 $ log 'heads(commonancestors(none()))'
1078
1091
1079 test ancestors with depth limit
1092 test ancestors with depth limit
1080
1093
1081 (depth=0 selects the node itself)
1094 (depth=0 selects the node itself)
1082
1095
1083 $ log 'reverse(ancestors(9, depth=0))'
1096 $ log 'reverse(ancestors(9, depth=0))'
1084 9
1097 9
1085
1098
1086 (interleaved: '4' would be missing if heap queue were higher depth first)
1099 (interleaved: '4' would be missing if heap queue were higher depth first)
1087
1100
1088 $ log 'reverse(ancestors(8:9, depth=1))'
1101 $ log 'reverse(ancestors(8:9, depth=1))'
1089 9
1102 9
1090 8
1103 8
1091 4
1104 4
1092
1105
1093 (interleaved: '2' would be missing if heap queue were higher depth first)
1106 (interleaved: '2' would be missing if heap queue were higher depth first)
1094
1107
1095 $ log 'reverse(ancestors(7+8, depth=2))'
1108 $ log 'reverse(ancestors(7+8, depth=2))'
1096 8
1109 8
1097 7
1110 7
1098 6
1111 6
1099 5
1112 5
1100 4
1113 4
1101 2
1114 2
1102
1115
1103 (walk example above by separate queries)
1116 (walk example above by separate queries)
1104
1117
1105 $ log 'reverse(ancestors(8, depth=2)) + reverse(ancestors(7, depth=2))'
1118 $ log 'reverse(ancestors(8, depth=2)) + reverse(ancestors(7, depth=2))'
1106 8
1119 8
1107 4
1120 4
1108 2
1121 2
1109 7
1122 7
1110 6
1123 6
1111 5
1124 5
1112
1125
1113 (walk 2nd and 3rd ancestors)
1126 (walk 2nd and 3rd ancestors)
1114
1127
1115 $ log 'reverse(ancestors(7, depth=3, startdepth=2))'
1128 $ log 'reverse(ancestors(7, depth=3, startdepth=2))'
1116 5
1129 5
1117 4
1130 4
1118 3
1131 3
1119 2
1132 2
1120
1133
1121 (interleaved: '4' would be missing if higher-depth ancestors weren't scanned)
1134 (interleaved: '4' would be missing if higher-depth ancestors weren't scanned)
1122
1135
1123 $ log 'reverse(ancestors(7+8, depth=2, startdepth=2))'
1136 $ log 'reverse(ancestors(7+8, depth=2, startdepth=2))'
1124 5
1137 5
1125 4
1138 4
1126 2
1139 2
1127
1140
1128 (note that 'ancestors(x, depth=y, startdepth=z)' does not identical to
1141 (note that 'ancestors(x, depth=y, startdepth=z)' does not identical to
1129 'ancestors(x, depth=y) - ancestors(x, depth=z-1)' because a node may have
1142 'ancestors(x, depth=y) - ancestors(x, depth=z-1)' because a node may have
1130 multiple depths)
1143 multiple depths)
1131
1144
1132 $ log 'reverse(ancestors(7+8, depth=2) - ancestors(7+8, depth=1))'
1145 $ log 'reverse(ancestors(7+8, depth=2) - ancestors(7+8, depth=1))'
1133 5
1146 5
1134 2
1147 2
1135
1148
1136 test bad arguments passed to ancestors()
1149 test bad arguments passed to ancestors()
1137
1150
1138 $ log 'ancestors(., depth=-1)'
1151 $ log 'ancestors(., depth=-1)'
1139 hg: parse error: negative depth
1152 hg: parse error: negative depth
1140 [255]
1153 [255]
1141 $ log 'ancestors(., depth=foo)'
1154 $ log 'ancestors(., depth=foo)'
1142 hg: parse error: ancestors expects an integer depth
1155 hg: parse error: ancestors expects an integer depth
1143 [255]
1156 [255]
1144
1157
1145 test descendants
1158 test descendants
1146
1159
1147 $ hg log -G -T '{rev}\n' --config experimental.graphshorten=True
1160 $ hg log -G -T '{rev}\n' --config experimental.graphshorten=True
1148 @ 9
1161 @ 9
1149 o 8
1162 o 8
1150 | o 7
1163 | o 7
1151 | o 6
1164 | o 6
1152 |/|
1165 |/|
1153 | o 5
1166 | o 5
1154 o | 4
1167 o | 4
1155 | o 3
1168 | o 3
1156 o | 2
1169 o | 2
1157 |/
1170 |/
1158 o 1
1171 o 1
1159 o 0
1172 o 0
1160
1173
1161 (null is ultimate root and has optimized path)
1174 (null is ultimate root and has optimized path)
1162
1175
1163 $ log 'null:4 & descendants(null)'
1176 $ log 'null:4 & descendants(null)'
1164 -1
1177 -1
1165 0
1178 0
1166 1
1179 1
1167 2
1180 2
1168 3
1181 3
1169 4
1182 4
1170
1183
1171 (including merge)
1184 (including merge)
1172
1185
1173 $ log ':8 & descendants(2)'
1186 $ log ':8 & descendants(2)'
1174 2
1187 2
1175 4
1188 4
1176 6
1189 6
1177 7
1190 7
1178 8
1191 8
1179
1192
1180 (multiple roots)
1193 (multiple roots)
1181
1194
1182 $ log ':8 & descendants(2+5)'
1195 $ log ':8 & descendants(2+5)'
1183 2
1196 2
1184 4
1197 4
1185 5
1198 5
1186 6
1199 6
1187 7
1200 7
1188 8
1201 8
1189
1202
1190 test descendants with depth limit
1203 test descendants with depth limit
1191
1204
1192 (depth=0 selects the node itself)
1205 (depth=0 selects the node itself)
1193
1206
1194 $ log 'descendants(0, depth=0)'
1207 $ log 'descendants(0, depth=0)'
1195 0
1208 0
1196 $ log 'null: & descendants(null, depth=0)'
1209 $ log 'null: & descendants(null, depth=0)'
1197 -1
1210 -1
1198
1211
1199 (p2 = null should be ignored)
1212 (p2 = null should be ignored)
1200
1213
1201 $ log 'null: & descendants(null, depth=2)'
1214 $ log 'null: & descendants(null, depth=2)'
1202 -1
1215 -1
1203 0
1216 0
1204 1
1217 1
1205
1218
1206 (multiple paths: depth(6) = (2, 3))
1219 (multiple paths: depth(6) = (2, 3))
1207
1220
1208 $ log 'descendants(1+3, depth=2)'
1221 $ log 'descendants(1+3, depth=2)'
1209 1
1222 1
1210 2
1223 2
1211 3
1224 3
1212 4
1225 4
1213 5
1226 5
1214 6
1227 6
1215
1228
1216 (multiple paths: depth(5) = (1, 2), depth(6) = (2, 3))
1229 (multiple paths: depth(5) = (1, 2), depth(6) = (2, 3))
1217
1230
1218 $ log 'descendants(3+1, depth=2, startdepth=2)'
1231 $ log 'descendants(3+1, depth=2, startdepth=2)'
1219 4
1232 4
1220 5
1233 5
1221 6
1234 6
1222
1235
1223 (multiple depths: depth(6) = (0, 2, 4), search for depth=2)
1236 (multiple depths: depth(6) = (0, 2, 4), search for depth=2)
1224
1237
1225 $ log 'descendants(0+3+6, depth=3, startdepth=1)'
1238 $ log 'descendants(0+3+6, depth=3, startdepth=1)'
1226 1
1239 1
1227 2
1240 2
1228 3
1241 3
1229 4
1242 4
1230 5
1243 5
1231 6
1244 6
1232 7
1245 7
1233
1246
1234 (multiple depths: depth(6) = (0, 4), no match)
1247 (multiple depths: depth(6) = (0, 4), no match)
1235
1248
1236 $ log 'descendants(0+6, depth=3, startdepth=1)'
1249 $ log 'descendants(0+6, depth=3, startdepth=1)'
1237 1
1250 1
1238 2
1251 2
1239 3
1252 3
1240 4
1253 4
1241 5
1254 5
1242 7
1255 7
1243
1256
1244 test ancestors/descendants relation subscript:
1257 test ancestors/descendants relation subscript:
1245
1258
1246 $ log 'tip#generations[0]'
1259 $ log 'tip#generations[0]'
1247 9
1260 9
1248 $ log '.#generations[-1]'
1261 $ log '.#generations[-1]'
1249 8
1262 8
1250 $ log '.#g[(-1)]'
1263 $ log '.#g[(-1)]'
1251 8
1264 8
1252
1265
1253 $ hg debugrevspec -p parsed 'roots(:)#g[2]'
1266 $ hg debugrevspec -p parsed 'roots(:)#g[2]'
1254 * parsed:
1267 * parsed:
1255 (relsubscript
1268 (relsubscript
1256 (func
1269 (func
1257 (symbol 'roots')
1270 (symbol 'roots')
1258 (rangeall
1271 (rangeall
1259 None))
1272 None))
1260 (symbol 'g')
1273 (symbol 'g')
1261 (symbol '2'))
1274 (symbol '2'))
1262 2
1275 2
1263 3
1276 3
1264
1277
1265 test author
1278 test author
1266
1279
1267 $ log 'author(bob)'
1280 $ log 'author(bob)'
1268 2
1281 2
1269 $ log 'author("re:bob|test")'
1282 $ log 'author("re:bob|test")'
1270 0
1283 0
1271 1
1284 1
1272 2
1285 2
1273 3
1286 3
1274 4
1287 4
1275 5
1288 5
1276 6
1289 6
1277 7
1290 7
1278 8
1291 8
1279 9
1292 9
1280 $ log 'author(r"re:\S")'
1293 $ log 'author(r"re:\S")'
1281 0
1294 0
1282 1
1295 1
1283 2
1296 2
1284 3
1297 3
1285 4
1298 4
1286 5
1299 5
1287 6
1300 6
1288 7
1301 7
1289 8
1302 8
1290 9
1303 9
1291 $ log 'branch(Γ©)'
1304 $ log 'branch(Γ©)'
1292 8
1305 8
1293 9
1306 9
1294 $ log 'branch(a)'
1307 $ log 'branch(a)'
1295 0
1308 0
1296 $ hg log -r 'branch("re:a")' --template '{rev} {branch}\n'
1309 $ hg log -r 'branch("re:a")' --template '{rev} {branch}\n'
1297 0 a
1310 0 a
1298 2 a-b-c-
1311 2 a-b-c-
1299 3 +a+b+c+
1312 3 +a+b+c+
1300 4 -a-b-c-
1313 4 -a-b-c-
1301 5 !a/b/c/
1314 5 !a/b/c/
1302 6 _a_b_c_
1315 6 _a_b_c_
1303 7 .a.b.c.
1316 7 .a.b.c.
1304 $ log 'children(ancestor(4,5))'
1317 $ log 'children(ancestor(4,5))'
1305 2
1318 2
1306 3
1319 3
1307
1320
1308 $ log 'children(4)'
1321 $ log 'children(4)'
1309 6
1322 6
1310 8
1323 8
1311 $ log 'children(null)'
1324 $ log 'children(null)'
1312 0
1325 0
1313
1326
1314 $ log 'closed()'
1327 $ log 'closed()'
1315 $ log 'contains(a)'
1328 $ log 'contains(a)'
1316 0
1329 0
1317 1
1330 1
1318 3
1331 3
1319 5
1332 5
1320 $ log 'contains("../repo/a")'
1333 $ log 'contains("../repo/a")'
1321 0
1334 0
1322 1
1335 1
1323 3
1336 3
1324 5
1337 5
1325 $ log 'desc(B)'
1338 $ log 'desc(B)'
1326 5
1339 5
1327 $ hg log -r 'desc(r"re:S?u")' --template "{rev} {desc|firstline}\n"
1340 $ hg log -r 'desc(r"re:S?u")' --template "{rev} {desc|firstline}\n"
1328 5 5 bug
1341 5 5 bug
1329 6 6 issue619
1342 6 6 issue619
1330 $ log 'descendants(2 or 3)'
1343 $ log 'descendants(2 or 3)'
1331 2
1344 2
1332 3
1345 3
1333 4
1346 4
1334 5
1347 5
1335 6
1348 6
1336 7
1349 7
1337 8
1350 8
1338 9
1351 9
1339 $ log 'file("b*")'
1352 $ log 'file("b*")'
1340 1
1353 1
1341 4
1354 4
1342 $ log 'filelog("b")'
1355 $ log 'filelog("b")'
1343 1
1356 1
1344 4
1357 4
1345 $ log 'filelog("../repo/b")'
1358 $ log 'filelog("../repo/b")'
1346 1
1359 1
1347 4
1360 4
1348 $ log 'follow()'
1361 $ log 'follow()'
1349 0
1362 0
1350 1
1363 1
1351 2
1364 2
1352 4
1365 4
1353 8
1366 8
1354 9
1367 9
1355 $ log 'grep("issue\d+")'
1368 $ log 'grep("issue\d+")'
1356 6
1369 6
1357 $ try 'grep("(")' # invalid regular expression
1370 $ try 'grep("(")' # invalid regular expression
1358 (func
1371 (func
1359 (symbol 'grep')
1372 (symbol 'grep')
1360 (string '('))
1373 (string '('))
1361 hg: parse error: invalid match pattern: (unbalanced parenthesis|missing \),.*) (re)
1374 hg: parse error: invalid match pattern: (unbalanced parenthesis|missing \),.*) (re)
1362 [255]
1375 [255]
1363 $ try 'grep("\bissue\d+")'
1376 $ try 'grep("\bissue\d+")'
1364 (func
1377 (func
1365 (symbol 'grep')
1378 (symbol 'grep')
1366 (string '\x08issue\\d+'))
1379 (string '\x08issue\\d+'))
1367 * set:
1380 * set:
1368 <filteredset
1381 <filteredset
1369 <fullreposet+ 0:10>,
1382 <fullreposet+ 0:10>,
1370 <grep '\x08issue\\d+'>>
1383 <grep '\x08issue\\d+'>>
1371 $ try 'grep(r"\bissue\d+")'
1384 $ try 'grep(r"\bissue\d+")'
1372 (func
1385 (func
1373 (symbol 'grep')
1386 (symbol 'grep')
1374 (string '\\bissue\\d+'))
1387 (string '\\bissue\\d+'))
1375 * set:
1388 * set:
1376 <filteredset
1389 <filteredset
1377 <fullreposet+ 0:10>,
1390 <fullreposet+ 0:10>,
1378 <grep '\\bissue\\d+'>>
1391 <grep '\\bissue\\d+'>>
1379 6
1392 6
1380 $ try 'grep(r"\")'
1393 $ try 'grep(r"\")'
1381 hg: parse error at 7: unterminated string
1394 hg: parse error at 7: unterminated string
1382 (grep(r"\")
1395 (grep(r"\")
1383 ^ here)
1396 ^ here)
1384 [255]
1397 [255]
1385 $ log 'head()'
1398 $ log 'head()'
1386 0
1399 0
1387 1
1400 1
1388 2
1401 2
1389 3
1402 3
1390 4
1403 4
1391 5
1404 5
1392 6
1405 6
1393 7
1406 7
1394 9
1407 9
1395
1408
1396 Test heads
1409 Test heads
1397
1410
1398 $ log 'heads(6::)'
1411 $ log 'heads(6::)'
1399 7
1412 7
1400
1413
1401 heads() can be computed in subset '9:'
1414 heads() can be computed in subset '9:'
1402
1415
1403 $ hg debugrevspec -s '9: & heads(all())'
1416 $ hg debugrevspec -s '9: & heads(all())'
1404 * set:
1417 * set:
1405 <filteredset
1418 <filteredset
1406 <filteredset
1419 <filteredset
1407 <baseset [9]>,
1420 <baseset [9]>,
1408 <spanset+ 0:10>>,
1421 <spanset+ 0:10>>,
1409 <not
1422 <not
1410 <filteredset
1423 <filteredset
1411 <baseset [9]>, set([0, 1, 2, 3, 4, 5, 6, 8])>>>
1424 <baseset [9]>, set([0, 1, 2, 3, 4, 5, 6, 8])>>>
1412 9
1425 9
1413
1426
1414 but should follow the order of the subset
1427 but should follow the order of the subset
1415
1428
1416 $ log 'heads(all())'
1429 $ log 'heads(all())'
1417 7
1430 7
1418 9
1431 9
1419 $ log 'heads(tip:0)'
1432 $ log 'heads(tip:0)'
1420 7
1433 7
1421 9
1434 9
1422 $ log 'tip:0 & heads(all())'
1435 $ log 'tip:0 & heads(all())'
1423 9
1436 9
1424 7
1437 7
1425 $ log 'tip:0 & heads(0:tip)'
1438 $ log 'tip:0 & heads(0:tip)'
1426 9
1439 9
1427 7
1440 7
1428
1441
1429 $ log 'keyword(issue)'
1442 $ log 'keyword(issue)'
1430 6
1443 6
1431 $ log 'keyword("test a")'
1444 $ log 'keyword("test a")'
1432
1445
1433 Test first (=limit) and last
1446 Test first (=limit) and last
1434
1447
1435 $ log 'limit(head(), 1)'
1448 $ log 'limit(head(), 1)'
1436 0
1449 0
1437 $ log 'limit(author("re:bob|test"), 3, 5)'
1450 $ log 'limit(author("re:bob|test"), 3, 5)'
1438 5
1451 5
1439 6
1452 6
1440 7
1453 7
1441 $ log 'limit(author("re:bob|test"), offset=6)'
1454 $ log 'limit(author("re:bob|test"), offset=6)'
1442 6
1455 6
1443 $ log 'limit(author("re:bob|test"), offset=10)'
1456 $ log 'limit(author("re:bob|test"), offset=10)'
1444 $ log 'limit(all(), 1, -1)'
1457 $ log 'limit(all(), 1, -1)'
1445 hg: parse error: negative offset
1458 hg: parse error: negative offset
1446 [255]
1459 [255]
1447 $ log 'limit(all(), -1)'
1460 $ log 'limit(all(), -1)'
1448 hg: parse error: negative number to select
1461 hg: parse error: negative number to select
1449 [255]
1462 [255]
1450 $ log 'limit(all(), 0)'
1463 $ log 'limit(all(), 0)'
1451
1464
1452 $ log 'last(all(), -1)'
1465 $ log 'last(all(), -1)'
1453 hg: parse error: negative number to select
1466 hg: parse error: negative number to select
1454 [255]
1467 [255]
1455 $ log 'last(all(), 0)'
1468 $ log 'last(all(), 0)'
1456 $ log 'last(all(), 1)'
1469 $ log 'last(all(), 1)'
1457 9
1470 9
1458 $ log 'last(all(), 2)'
1471 $ log 'last(all(), 2)'
1459 8
1472 8
1460 9
1473 9
1461
1474
1462 Test smartset.slice() by first/last()
1475 Test smartset.slice() by first/last()
1463
1476
1464 (using unoptimized set, filteredset as example)
1477 (using unoptimized set, filteredset as example)
1465
1478
1466 $ hg debugrevspec --no-show-revs -s '0:7 & branch("re:")'
1479 $ hg debugrevspec --no-show-revs -s '0:7 & branch("re:")'
1467 * set:
1480 * set:
1468 <filteredset
1481 <filteredset
1469 <spanset+ 0:8>,
1482 <spanset+ 0:8>,
1470 <branch 're:'>>
1483 <branch 're:'>>
1471 $ log 'limit(0:7 & branch("re:"), 3, 4)'
1484 $ log 'limit(0:7 & branch("re:"), 3, 4)'
1472 4
1485 4
1473 5
1486 5
1474 6
1487 6
1475 $ log 'limit(7:0 & branch("re:"), 3, 4)'
1488 $ log 'limit(7:0 & branch("re:"), 3, 4)'
1476 3
1489 3
1477 2
1490 2
1478 1
1491 1
1479 $ log 'last(0:7 & branch("re:"), 2)'
1492 $ log 'last(0:7 & branch("re:"), 2)'
1480 6
1493 6
1481 7
1494 7
1482
1495
1483 (using baseset)
1496 (using baseset)
1484
1497
1485 $ hg debugrevspec --no-show-revs -s 0+1+2+3+4+5+6+7
1498 $ hg debugrevspec --no-show-revs -s 0+1+2+3+4+5+6+7
1486 * set:
1499 * set:
1487 <baseset [0, 1, 2, 3, 4, 5, 6, 7]>
1500 <baseset [0, 1, 2, 3, 4, 5, 6, 7]>
1488 $ hg debugrevspec --no-show-revs -s 0::7
1501 $ hg debugrevspec --no-show-revs -s 0::7
1489 * set:
1502 * set:
1490 <baseset+ [0, 1, 2, 3, 4, 5, 6, 7]>
1503 <baseset+ [0, 1, 2, 3, 4, 5, 6, 7]>
1491 $ log 'limit(0+1+2+3+4+5+6+7, 3, 4)'
1504 $ log 'limit(0+1+2+3+4+5+6+7, 3, 4)'
1492 4
1505 4
1493 5
1506 5
1494 6
1507 6
1495 $ log 'limit(sort(0::7, rev), 3, 4)'
1508 $ log 'limit(sort(0::7, rev), 3, 4)'
1496 4
1509 4
1497 5
1510 5
1498 6
1511 6
1499 $ log 'limit(sort(0::7, -rev), 3, 4)'
1512 $ log 'limit(sort(0::7, -rev), 3, 4)'
1500 3
1513 3
1501 2
1514 2
1502 1
1515 1
1503 $ log 'last(sort(0::7, rev), 2)'
1516 $ log 'last(sort(0::7, rev), 2)'
1504 6
1517 6
1505 7
1518 7
1506 $ hg debugrevspec -s 'limit(sort(0::7, rev), 3, 6)'
1519 $ hg debugrevspec -s 'limit(sort(0::7, rev), 3, 6)'
1507 * set:
1520 * set:
1508 <baseset+ [6, 7]>
1521 <baseset+ [6, 7]>
1509 6
1522 6
1510 7
1523 7
1511 $ hg debugrevspec -s 'limit(sort(0::7, rev), 3, 9)'
1524 $ hg debugrevspec -s 'limit(sort(0::7, rev), 3, 9)'
1512 * set:
1525 * set:
1513 <baseset+ []>
1526 <baseset+ []>
1514 $ hg debugrevspec -s 'limit(sort(0::7, -rev), 3, 6)'
1527 $ hg debugrevspec -s 'limit(sort(0::7, -rev), 3, 6)'
1515 * set:
1528 * set:
1516 <baseset- [0, 1]>
1529 <baseset- [0, 1]>
1517 1
1530 1
1518 0
1531 0
1519 $ hg debugrevspec -s 'limit(sort(0::7, -rev), 3, 9)'
1532 $ hg debugrevspec -s 'limit(sort(0::7, -rev), 3, 9)'
1520 * set:
1533 * set:
1521 <baseset- []>
1534 <baseset- []>
1522 $ hg debugrevspec -s 'limit(0::7, 0)'
1535 $ hg debugrevspec -s 'limit(0::7, 0)'
1523 * set:
1536 * set:
1524 <baseset+ []>
1537 <baseset+ []>
1525
1538
1526 (using spanset)
1539 (using spanset)
1527
1540
1528 $ hg debugrevspec --no-show-revs -s 0:7
1541 $ hg debugrevspec --no-show-revs -s 0:7
1529 * set:
1542 * set:
1530 <spanset+ 0:8>
1543 <spanset+ 0:8>
1531 $ log 'limit(0:7, 3, 4)'
1544 $ log 'limit(0:7, 3, 4)'
1532 4
1545 4
1533 5
1546 5
1534 6
1547 6
1535 $ log 'limit(7:0, 3, 4)'
1548 $ log 'limit(7:0, 3, 4)'
1536 3
1549 3
1537 2
1550 2
1538 1
1551 1
1539 $ log 'limit(0:7, 3, 6)'
1552 $ log 'limit(0:7, 3, 6)'
1540 6
1553 6
1541 7
1554 7
1542 $ log 'limit(7:0, 3, 6)'
1555 $ log 'limit(7:0, 3, 6)'
1543 1
1556 1
1544 0
1557 0
1545 $ log 'last(0:7, 2)'
1558 $ log 'last(0:7, 2)'
1546 6
1559 6
1547 7
1560 7
1548 $ hg debugrevspec -s 'limit(0:7, 3, 6)'
1561 $ hg debugrevspec -s 'limit(0:7, 3, 6)'
1549 * set:
1562 * set:
1550 <spanset+ 6:8>
1563 <spanset+ 6:8>
1551 6
1564 6
1552 7
1565 7
1553 $ hg debugrevspec -s 'limit(0:7, 3, 9)'
1566 $ hg debugrevspec -s 'limit(0:7, 3, 9)'
1554 * set:
1567 * set:
1555 <spanset+ 8:8>
1568 <spanset+ 8:8>
1556 $ hg debugrevspec -s 'limit(7:0, 3, 6)'
1569 $ hg debugrevspec -s 'limit(7:0, 3, 6)'
1557 * set:
1570 * set:
1558 <spanset- 0:2>
1571 <spanset- 0:2>
1559 1
1572 1
1560 0
1573 0
1561 $ hg debugrevspec -s 'limit(7:0, 3, 9)'
1574 $ hg debugrevspec -s 'limit(7:0, 3, 9)'
1562 * set:
1575 * set:
1563 <spanset- 0:0>
1576 <spanset- 0:0>
1564 $ hg debugrevspec -s 'limit(0:7, 0)'
1577 $ hg debugrevspec -s 'limit(0:7, 0)'
1565 * set:
1578 * set:
1566 <spanset+ 0:0>
1579 <spanset+ 0:0>
1567
1580
1568 Test order of first/last revisions
1581 Test order of first/last revisions
1569
1582
1570 $ hg debugrevspec -s 'first(4:0, 3) & 3:'
1583 $ hg debugrevspec -s 'first(4:0, 3) & 3:'
1571 * set:
1584 * set:
1572 <filteredset
1585 <filteredset
1573 <spanset- 2:5>,
1586 <spanset- 2:5>,
1574 <spanset+ 3:10>>
1587 <spanset+ 3:10>>
1575 4
1588 4
1576 3
1589 3
1577
1590
1578 $ hg debugrevspec -s '3: & first(4:0, 3)'
1591 $ hg debugrevspec -s '3: & first(4:0, 3)'
1579 * set:
1592 * set:
1580 <filteredset
1593 <filteredset
1581 <spanset+ 3:10>,
1594 <spanset+ 3:10>,
1582 <spanset- 2:5>>
1595 <spanset- 2:5>>
1583 3
1596 3
1584 4
1597 4
1585
1598
1586 $ hg debugrevspec -s 'last(4:0, 3) & :1'
1599 $ hg debugrevspec -s 'last(4:0, 3) & :1'
1587 * set:
1600 * set:
1588 <filteredset
1601 <filteredset
1589 <spanset- 0:3>,
1602 <spanset- 0:3>,
1590 <spanset+ 0:2>>
1603 <spanset+ 0:2>>
1591 1
1604 1
1592 0
1605 0
1593
1606
1594 $ hg debugrevspec -s ':1 & last(4:0, 3)'
1607 $ hg debugrevspec -s ':1 & last(4:0, 3)'
1595 * set:
1608 * set:
1596 <filteredset
1609 <filteredset
1597 <spanset+ 0:2>,
1610 <spanset+ 0:2>,
1598 <spanset+ 0:3>>
1611 <spanset+ 0:3>>
1599 0
1612 0
1600 1
1613 1
1601
1614
1602 Test scmutil.revsingle() should return the last revision
1615 Test scmutil.revsingle() should return the last revision
1603
1616
1604 $ hg debugrevspec -s 'last(0::)'
1617 $ hg debugrevspec -s 'last(0::)'
1605 * set:
1618 * set:
1606 <baseset slice=0:1
1619 <baseset slice=0:1
1607 <generatorsetasc->>
1620 <generatorsetasc->>
1608 9
1621 9
1609 $ hg identify -r '0::' --num
1622 $ hg identify -r '0::' --num
1610 9
1623 9
1611
1624
1612 Test matching
1625 Test matching
1613
1626
1614 $ log 'matching(6)'
1627 $ log 'matching(6)'
1615 6
1628 6
1616 $ log 'matching(6:7, "phase parents user date branch summary files description substate")'
1629 $ log 'matching(6:7, "phase parents user date branch summary files description substate")'
1617 6
1630 6
1618 7
1631 7
1619
1632
1620 Testing min and max
1633 Testing min and max
1621
1634
1622 max: simple
1635 max: simple
1623
1636
1624 $ log 'max(contains(a))'
1637 $ log 'max(contains(a))'
1625 5
1638 5
1626
1639
1627 max: simple on unordered set)
1640 max: simple on unordered set)
1628
1641
1629 $ log 'max((4+0+2+5+7) and contains(a))'
1642 $ log 'max((4+0+2+5+7) and contains(a))'
1630 5
1643 5
1631
1644
1632 max: no result
1645 max: no result
1633
1646
1634 $ log 'max(contains(stringthatdoesnotappearanywhere))'
1647 $ log 'max(contains(stringthatdoesnotappearanywhere))'
1635
1648
1636 max: no result on unordered set
1649 max: no result on unordered set
1637
1650
1638 $ log 'max((4+0+2+5+7) and contains(stringthatdoesnotappearanywhere))'
1651 $ log 'max((4+0+2+5+7) and contains(stringthatdoesnotappearanywhere))'
1639
1652
1640 min: simple
1653 min: simple
1641
1654
1642 $ log 'min(contains(a))'
1655 $ log 'min(contains(a))'
1643 0
1656 0
1644
1657
1645 min: simple on unordered set
1658 min: simple on unordered set
1646
1659
1647 $ log 'min((4+0+2+5+7) and contains(a))'
1660 $ log 'min((4+0+2+5+7) and contains(a))'
1648 0
1661 0
1649
1662
1650 min: empty
1663 min: empty
1651
1664
1652 $ log 'min(contains(stringthatdoesnotappearanywhere))'
1665 $ log 'min(contains(stringthatdoesnotappearanywhere))'
1653
1666
1654 min: empty on unordered set
1667 min: empty on unordered set
1655
1668
1656 $ log 'min((4+0+2+5+7) and contains(stringthatdoesnotappearanywhere))'
1669 $ log 'min((4+0+2+5+7) and contains(stringthatdoesnotappearanywhere))'
1657
1670
1658
1671
1659 $ log 'merge()'
1672 $ log 'merge()'
1660 6
1673 6
1661 $ log 'branchpoint()'
1674 $ log 'branchpoint()'
1662 1
1675 1
1663 4
1676 4
1664 $ log 'modifies(b)'
1677 $ log 'modifies(b)'
1665 4
1678 4
1666 $ log 'modifies("path:b")'
1679 $ log 'modifies("path:b")'
1667 4
1680 4
1668 $ log 'modifies("*")'
1681 $ log 'modifies("*")'
1669 4
1682 4
1670 6
1683 6
1671 $ log 'modifies("set:modified()")'
1684 $ log 'modifies("set:modified()")'
1672 4
1685 4
1673 $ log 'id(5)'
1686 $ log 'id(5)'
1674 2
1687 2
1675 $ log 'only(9)'
1688 $ log 'only(9)'
1676 8
1689 8
1677 9
1690 9
1678 $ log 'only(8)'
1691 $ log 'only(8)'
1679 8
1692 8
1680 $ log 'only(9, 5)'
1693 $ log 'only(9, 5)'
1681 2
1694 2
1682 4
1695 4
1683 8
1696 8
1684 9
1697 9
1685 $ log 'only(7 + 9, 5 + 2)'
1698 $ log 'only(7 + 9, 5 + 2)'
1686 4
1699 4
1687 6
1700 6
1688 7
1701 7
1689 8
1702 8
1690 9
1703 9
1691
1704
1692 Test empty set input
1705 Test empty set input
1693 $ log 'only(p2())'
1706 $ log 'only(p2())'
1694 $ log 'only(p1(), p2())'
1707 $ log 'only(p1(), p2())'
1695 0
1708 0
1696 1
1709 1
1697 2
1710 2
1698 4
1711 4
1699 8
1712 8
1700 9
1713 9
1701
1714
1702 Test '%' operator
1715 Test '%' operator
1703
1716
1704 $ log '9%'
1717 $ log '9%'
1705 8
1718 8
1706 9
1719 9
1707 $ log '9%5'
1720 $ log '9%5'
1708 2
1721 2
1709 4
1722 4
1710 8
1723 8
1711 9
1724 9
1712 $ log '(7 + 9)%(5 + 2)'
1725 $ log '(7 + 9)%(5 + 2)'
1713 4
1726 4
1714 6
1727 6
1715 7
1728 7
1716 8
1729 8
1717 9
1730 9
1718
1731
1719 Test operand of '%' is optimized recursively (issue4670)
1732 Test operand of '%' is optimized recursively (issue4670)
1720
1733
1721 $ try --optimize '8:9-8%'
1734 $ try --optimize '8:9-8%'
1722 (onlypost
1735 (onlypost
1723 (minus
1736 (minus
1724 (range
1737 (range
1725 (symbol '8')
1738 (symbol '8')
1726 (symbol '9'))
1739 (symbol '9'))
1727 (symbol '8')))
1740 (symbol '8')))
1728 * optimized:
1741 * optimized:
1729 (func
1742 (func
1730 (symbol 'only')
1743 (symbol 'only')
1731 (difference
1744 (difference
1732 (range
1745 (range
1733 (symbol '8')
1746 (symbol '8')
1734 (symbol '9'))
1747 (symbol '9'))
1735 (symbol '8')))
1748 (symbol '8')))
1736 * set:
1749 * set:
1737 <baseset+ [8, 9]>
1750 <baseset+ [8, 9]>
1738 8
1751 8
1739 9
1752 9
1740 $ try --optimize '(9)%(5)'
1753 $ try --optimize '(9)%(5)'
1741 (only
1754 (only
1742 (group
1755 (group
1743 (symbol '9'))
1756 (symbol '9'))
1744 (group
1757 (group
1745 (symbol '5')))
1758 (symbol '5')))
1746 * optimized:
1759 * optimized:
1747 (func
1760 (func
1748 (symbol 'only')
1761 (symbol 'only')
1749 (list
1762 (list
1750 (symbol '9')
1763 (symbol '9')
1751 (symbol '5')))
1764 (symbol '5')))
1752 * set:
1765 * set:
1753 <baseset+ [2, 4, 8, 9]>
1766 <baseset+ [2, 4, 8, 9]>
1754 2
1767 2
1755 4
1768 4
1756 8
1769 8
1757 9
1770 9
1758
1771
1759 Test the order of operations
1772 Test the order of operations
1760
1773
1761 $ log '7 + 9%5 + 2'
1774 $ log '7 + 9%5 + 2'
1762 7
1775 7
1763 2
1776 2
1764 4
1777 4
1765 8
1778 8
1766 9
1779 9
1767
1780
1768 Test explicit numeric revision
1781 Test explicit numeric revision
1769 $ log 'rev(-2)'
1782 $ log 'rev(-2)'
1770 $ log 'rev(-1)'
1783 $ log 'rev(-1)'
1771 -1
1784 -1
1772 $ log 'rev(0)'
1785 $ log 'rev(0)'
1773 0
1786 0
1774 $ log 'rev(9)'
1787 $ log 'rev(9)'
1775 9
1788 9
1776 $ log 'rev(10)'
1789 $ log 'rev(10)'
1777 $ log 'rev(tip)'
1790 $ log 'rev(tip)'
1778 hg: parse error: rev expects a number
1791 hg: parse error: rev expects a number
1779 [255]
1792 [255]
1780
1793
1781 Test hexadecimal revision
1794 Test hexadecimal revision
1782 $ log 'id(2)'
1795 $ log 'id(2)'
1783 $ log 'id(23268)'
1796 $ log 'id(23268)'
1784 4
1797 4
1785 $ log 'id(2785f51eece)'
1798 $ log 'id(2785f51eece)'
1786 0
1799 0
1787 $ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532c)'
1800 $ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532c)'
1788 8
1801 8
1789 $ log 'id(d5d0dcbdc4a)'
1802 $ log 'id(d5d0dcbdc4a)'
1790 $ log 'id(d5d0dcbdc4w)'
1803 $ log 'id(d5d0dcbdc4w)'
1791 $ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532d)'
1804 $ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532d)'
1792 $ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532q)'
1805 $ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532q)'
1793 $ log 'id(1.0)'
1806 $ log 'id(1.0)'
1794 $ log 'id(xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)'
1807 $ log 'id(xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)'
1795
1808
1796 Test null revision
1809 Test null revision
1797 $ log '(null)'
1810 $ log '(null)'
1798 -1
1811 -1
1799 $ log '(null:0)'
1812 $ log '(null:0)'
1800 -1
1813 -1
1801 0
1814 0
1802 $ log '(0:null)'
1815 $ log '(0:null)'
1803 0
1816 0
1804 -1
1817 -1
1805 $ log 'null::0'
1818 $ log 'null::0'
1806 -1
1819 -1
1807 0
1820 0
1808 $ log 'null:tip - 0:'
1821 $ log 'null:tip - 0:'
1809 -1
1822 -1
1810 $ log 'null: and null::' | head -1
1823 $ log 'null: and null::' | head -1
1811 -1
1824 -1
1812 $ log 'null: or 0:' | head -2
1825 $ log 'null: or 0:' | head -2
1813 -1
1826 -1
1814 0
1827 0
1815 $ log 'ancestors(null)'
1828 $ log 'ancestors(null)'
1816 -1
1829 -1
1817 $ log 'reverse(null:)' | tail -2
1830 $ log 'reverse(null:)' | tail -2
1818 0
1831 0
1819 -1
1832 -1
1820 $ log 'first(null:)'
1833 $ log 'first(null:)'
1821 -1
1834 -1
1822 $ log 'min(null:)'
1835 $ log 'min(null:)'
1823 BROKEN: should be '-1'
1836 BROKEN: should be '-1'
1824 $ log 'tip:null and all()' | tail -2
1837 $ log 'tip:null and all()' | tail -2
1825 1
1838 1
1826 0
1839 0
1827
1840
1828 Test working-directory revision
1841 Test working-directory revision
1829 $ hg debugrevspec 'wdir()'
1842 $ hg debugrevspec 'wdir()'
1830 2147483647
1843 2147483647
1831 $ hg debugrevspec 'wdir()^'
1844 $ hg debugrevspec 'wdir()^'
1832 9
1845 9
1833 $ hg up 7
1846 $ hg up 7
1834 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1847 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1835 $ hg debugrevspec 'wdir()^'
1848 $ hg debugrevspec 'wdir()^'
1836 7
1849 7
1837 $ hg debugrevspec 'wdir()^0'
1850 $ hg debugrevspec 'wdir()^0'
1838 2147483647
1851 2147483647
1839 $ hg debugrevspec 'wdir()~3'
1852 $ hg debugrevspec 'wdir()~3'
1840 5
1853 5
1841 $ hg debugrevspec 'ancestors(wdir())'
1854 $ hg debugrevspec 'ancestors(wdir())'
1842 0
1855 0
1843 1
1856 1
1844 2
1857 2
1845 3
1858 3
1846 4
1859 4
1847 5
1860 5
1848 6
1861 6
1849 7
1862 7
1850 2147483647
1863 2147483647
1851 $ hg debugrevspec '0:wdir() & ancestor(wdir())'
1864 $ hg debugrevspec '0:wdir() & ancestor(wdir())'
1852 2147483647
1865 2147483647
1853 $ hg debugrevspec '0:wdir() & ancestor(.:wdir())'
1866 $ hg debugrevspec '0:wdir() & ancestor(.:wdir())'
1854 4
1867 4
1855 $ hg debugrevspec '0:wdir() & ancestor(wdir(), wdir())'
1868 $ hg debugrevspec '0:wdir() & ancestor(wdir(), wdir())'
1856 2147483647
1869 2147483647
1857 $ hg debugrevspec '0:wdir() & ancestor(wdir(), tip)'
1870 $ hg debugrevspec '0:wdir() & ancestor(wdir(), tip)'
1858 4
1871 4
1859 $ hg debugrevspec 'null:wdir() & ancestor(wdir(), null)'
1872 $ hg debugrevspec 'null:wdir() & ancestor(wdir(), null)'
1860 -1
1873 -1
1861 $ hg debugrevspec 'wdir()~0'
1874 $ hg debugrevspec 'wdir()~0'
1862 2147483647
1875 2147483647
1863 $ hg debugrevspec 'p1(wdir())'
1876 $ hg debugrevspec 'p1(wdir())'
1864 7
1877 7
1865 $ hg debugrevspec 'p2(wdir())'
1878 $ hg debugrevspec 'p2(wdir())'
1866 $ hg debugrevspec 'parents(wdir())'
1879 $ hg debugrevspec 'parents(wdir())'
1867 7
1880 7
1868 $ hg debugrevspec 'wdir()^1'
1881 $ hg debugrevspec 'wdir()^1'
1869 7
1882 7
1870 $ hg debugrevspec 'wdir()^2'
1883 $ hg debugrevspec 'wdir()^2'
1871 $ hg debugrevspec 'wdir()^3'
1884 $ hg debugrevspec 'wdir()^3'
1872 hg: parse error: ^ expects a number 0, 1, or 2
1885 hg: parse error: ^ expects a number 0, 1, or 2
1873 [255]
1886 [255]
1874 For tests consistency
1887 For tests consistency
1875 $ hg up 9
1888 $ hg up 9
1876 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1889 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1877 $ hg debugrevspec 'tip or wdir()'
1890 $ hg debugrevspec 'tip or wdir()'
1878 9
1891 9
1879 2147483647
1892 2147483647
1880 $ hg debugrevspec '0:tip and wdir()'
1893 $ hg debugrevspec '0:tip and wdir()'
1881 $ log '0:wdir()' | tail -3
1894 $ log '0:wdir()' | tail -3
1882 8
1895 8
1883 9
1896 9
1884 2147483647
1897 2147483647
1885 $ log 'wdir():0' | head -3
1898 $ log 'wdir():0' | head -3
1886 2147483647
1899 2147483647
1887 9
1900 9
1888 8
1901 8
1889 $ log 'wdir():wdir()'
1902 $ log 'wdir():wdir()'
1890 2147483647
1903 2147483647
1891 $ log '(all() + wdir()) & min(. + wdir())'
1904 $ log '(all() + wdir()) & min(. + wdir())'
1892 9
1905 9
1893 $ log '(all() + wdir()) & max(. + wdir())'
1906 $ log '(all() + wdir()) & max(. + wdir())'
1894 2147483647
1907 2147483647
1895 $ log 'first(wdir() + .)'
1908 $ log 'first(wdir() + .)'
1896 2147483647
1909 2147483647
1897 $ log 'last(. + wdir())'
1910 $ log 'last(. + wdir())'
1898 2147483647
1911 2147483647
1899
1912
1900 Test working-directory integer revision and node id
1913 Test working-directory integer revision and node id
1901 (BUG: '0:wdir()' is still needed to populate wdir revision)
1914 (BUG: '0:wdir()' is still needed to populate wdir revision)
1902
1915
1903 $ hg debugrevspec '0:wdir() & 2147483647'
1916 $ hg debugrevspec '0:wdir() & 2147483647'
1904 2147483647
1917 2147483647
1905 $ hg debugrevspec '0:wdir() & rev(2147483647)'
1918 $ hg debugrevspec '0:wdir() & rev(2147483647)'
1906 2147483647
1919 2147483647
1907 $ hg debugrevspec '0:wdir() & ffffffffffffffffffffffffffffffffffffffff'
1920 $ hg debugrevspec '0:wdir() & ffffffffffffffffffffffffffffffffffffffff'
1908 2147483647
1921 2147483647
1909 $ hg debugrevspec '0:wdir() & ffffffffffff'
1922 $ hg debugrevspec '0:wdir() & ffffffffffff'
1910 2147483647
1923 2147483647
1911 $ hg debugrevspec '0:wdir() & id(ffffffffffffffffffffffffffffffffffffffff)'
1924 $ hg debugrevspec '0:wdir() & id(ffffffffffffffffffffffffffffffffffffffff)'
1912 2147483647
1925 2147483647
1913 $ hg debugrevspec '0:wdir() & id(ffffffffffff)'
1926 $ hg debugrevspec '0:wdir() & id(ffffffffffff)'
1914 2147483647
1927 2147483647
1915
1928
1916 $ cd ..
1929 $ cd ..
1917
1930
1918 Test short 'ff...' hash collision
1931 Test short 'ff...' hash collision
1919 (BUG: '0:wdir()' is still needed to populate wdir revision)
1932 (BUG: '0:wdir()' is still needed to populate wdir revision)
1920
1933
1921 $ hg init wdir-hashcollision
1934 $ hg init wdir-hashcollision
1922 $ cd wdir-hashcollision
1935 $ cd wdir-hashcollision
1923 $ cat <<EOF >> .hg/hgrc
1936 $ cat <<EOF >> .hg/hgrc
1924 > [experimental]
1937 > [experimental]
1925 > evolution.createmarkers=True
1938 > evolution.createmarkers=True
1926 > EOF
1939 > EOF
1927 $ echo 0 > a
1940 $ echo 0 > a
1928 $ hg ci -qAm 0
1941 $ hg ci -qAm 0
1929 $ for i in 2463 2961 6726 78127; do
1942 $ for i in 2463 2961 6726 78127; do
1930 > hg up -q 0
1943 > hg up -q 0
1931 > echo $i > a
1944 > echo $i > a
1932 > hg ci -qm $i
1945 > hg ci -qm $i
1933 > done
1946 > done
1934 $ hg up -q null
1947 $ hg up -q null
1935 $ hg log -r '0:wdir()' -T '{rev}:{node} {shortest(node, 3)}\n'
1948 $ hg log -r '0:wdir()' -T '{rev}:{node} {shortest(node, 3)}\n'
1936 0:b4e73ffab476aa0ee32ed81ca51e07169844bc6a b4e
1949 0:b4e73ffab476aa0ee32ed81ca51e07169844bc6a b4e
1937 1:fffbae3886c8fbb2114296380d276fd37715d571 fffba
1950 1:fffbae3886c8fbb2114296380d276fd37715d571 fffba
1938 2:fffb6093b00943f91034b9bdad069402c834e572 fffb6
1951 2:fffb6093b00943f91034b9bdad069402c834e572 fffb6
1939 3:fff48a9b9de34a4d64120c29548214c67980ade3 fff4
1952 3:fff48a9b9de34a4d64120c29548214c67980ade3 fff4
1940 4:ffff85cff0ff78504fcdc3c0bc10de0c65379249 ffff8
1953 4:ffff85cff0ff78504fcdc3c0bc10de0c65379249 ffff8
1941 2147483647:ffffffffffffffffffffffffffffffffffffffff fffff
1954 2147483647:ffffffffffffffffffffffffffffffffffffffff fffff
1942 $ hg debugobsolete fffbae3886c8fbb2114296380d276fd37715d571
1955 $ hg debugobsolete fffbae3886c8fbb2114296380d276fd37715d571
1943 obsoleted 1 changesets
1956 obsoleted 1 changesets
1944
1957
1945 $ hg debugrevspec '0:wdir() & fff'
1958 $ hg debugrevspec '0:wdir() & fff'
1946 abort: 00changelog.i@fff: ambiguous identifier!
1959 abort: 00changelog.i@fff: ambiguous identifier!
1947 [255]
1960 [255]
1948 $ hg debugrevspec '0:wdir() & ffff'
1961 $ hg debugrevspec '0:wdir() & ffff'
1949 abort: 00changelog.i@ffff: ambiguous identifier!
1962 abort: 00changelog.i@ffff: ambiguous identifier!
1950 [255]
1963 [255]
1951 $ hg debugrevspec '0:wdir() & fffb'
1964 $ hg debugrevspec '0:wdir() & fffb'
1952 abort: 00changelog.i@fffb: ambiguous identifier!
1965 abort: 00changelog.i@fffb: ambiguous identifier!
1953 [255]
1966 [255]
1954 BROKEN should be '2' (node lookup uses unfiltered repo)
1967 BROKEN should be '2' (node lookup uses unfiltered repo)
1955 $ hg debugrevspec '0:wdir() & id(fffb)'
1968 $ hg debugrevspec '0:wdir() & id(fffb)'
1956 BROKEN should be '2' (node lookup uses unfiltered repo)
1969 BROKEN should be '2' (node lookup uses unfiltered repo)
1957 $ hg debugrevspec '0:wdir() & ffff8'
1970 $ hg debugrevspec '0:wdir() & ffff8'
1958 4
1971 4
1959 $ hg debugrevspec '0:wdir() & fffff'
1972 $ hg debugrevspec '0:wdir() & fffff'
1960 2147483647
1973 2147483647
1961
1974
1962 $ cd ..
1975 $ cd ..
1963
1976
1964 Test branch() with wdir()
1977 Test branch() with wdir()
1965
1978
1966 $ cd repo
1979 $ cd repo
1967
1980
1968 $ log '0:wdir() & branch("literal:Γ©")'
1981 $ log '0:wdir() & branch("literal:Γ©")'
1969 8
1982 8
1970 9
1983 9
1971 2147483647
1984 2147483647
1972 $ log '0:wdir() & branch("re:Γ©")'
1985 $ log '0:wdir() & branch("re:Γ©")'
1973 8
1986 8
1974 9
1987 9
1975 2147483647
1988 2147483647
1976 $ log '0:wdir() & branch("re:^a")'
1989 $ log '0:wdir() & branch("re:^a")'
1977 0
1990 0
1978 2
1991 2
1979 $ log '0:wdir() & branch(8)'
1992 $ log '0:wdir() & branch(8)'
1980 8
1993 8
1981 9
1994 9
1982 2147483647
1995 2147483647
1983
1996
1984 branch(wdir()) returns all revisions belonging to the working branch. The wdir
1997 branch(wdir()) returns all revisions belonging to the working branch. The wdir
1985 itself isn't returned unless it is explicitly populated.
1998 itself isn't returned unless it is explicitly populated.
1986
1999
1987 $ log 'branch(wdir())'
2000 $ log 'branch(wdir())'
1988 8
2001 8
1989 9
2002 9
1990 $ log '0:wdir() & branch(wdir())'
2003 $ log '0:wdir() & branch(wdir())'
1991 8
2004 8
1992 9
2005 9
1993 2147483647
2006 2147483647
1994
2007
1995 $ log 'outgoing()'
2008 $ log 'outgoing()'
1996 8
2009 8
1997 9
2010 9
1998 $ log 'outgoing("../remote1")'
2011 $ log 'outgoing("../remote1")'
1999 8
2012 8
2000 9
2013 9
2001 $ log 'outgoing("../remote2")'
2014 $ log 'outgoing("../remote2")'
2002 3
2015 3
2003 5
2016 5
2004 6
2017 6
2005 7
2018 7
2006 9
2019 9
2007 $ log 'p1(merge())'
2020 $ log 'p1(merge())'
2008 5
2021 5
2009 $ log 'p2(merge())'
2022 $ log 'p2(merge())'
2010 4
2023 4
2011 $ log 'parents(merge())'
2024 $ log 'parents(merge())'
2012 4
2025 4
2013 5
2026 5
2014 $ log 'p1(branchpoint())'
2027 $ log 'p1(branchpoint())'
2015 0
2028 0
2016 2
2029 2
2017 $ log 'p2(branchpoint())'
2030 $ log 'p2(branchpoint())'
2018 $ log 'parents(branchpoint())'
2031 $ log 'parents(branchpoint())'
2019 0
2032 0
2020 2
2033 2
2021 $ log 'removes(a)'
2034 $ log 'removes(a)'
2022 2
2035 2
2023 6
2036 6
2024 $ log 'roots(all())'
2037 $ log 'roots(all())'
2025 0
2038 0
2026 $ log 'reverse(2 or 3 or 4 or 5)'
2039 $ log 'reverse(2 or 3 or 4 or 5)'
2027 5
2040 5
2028 4
2041 4
2029 3
2042 3
2030 2
2043 2
2031 $ log 'reverse(all())'
2044 $ log 'reverse(all())'
2032 9
2045 9
2033 8
2046 8
2034 7
2047 7
2035 6
2048 6
2036 5
2049 5
2037 4
2050 4
2038 3
2051 3
2039 2
2052 2
2040 1
2053 1
2041 0
2054 0
2042 $ log 'reverse(all()) & filelog(b)'
2055 $ log 'reverse(all()) & filelog(b)'
2043 4
2056 4
2044 1
2057 1
2045 $ log 'rev(5)'
2058 $ log 'rev(5)'
2046 5
2059 5
2047 $ log 'sort(limit(reverse(all()), 3))'
2060 $ log 'sort(limit(reverse(all()), 3))'
2048 7
2061 7
2049 8
2062 8
2050 9
2063 9
2051 $ log 'sort(2 or 3 or 4 or 5, date)'
2064 $ log 'sort(2 or 3 or 4 or 5, date)'
2052 2
2065 2
2053 3
2066 3
2054 5
2067 5
2055 4
2068 4
2056 $ log 'tagged()'
2069 $ log 'tagged()'
2057 6
2070 6
2058 $ log 'tag()'
2071 $ log 'tag()'
2059 6
2072 6
2060 $ log 'tag(1.0)'
2073 $ log 'tag(1.0)'
2061 6
2074 6
2062 $ log 'tag(tip)'
2075 $ log 'tag(tip)'
2063 9
2076 9
2064
2077
2065 Test order of revisions in compound expression
2078 Test order of revisions in compound expression
2066 ----------------------------------------------
2079 ----------------------------------------------
2067
2080
2068 The general rule is that only the outermost (= leftmost) predicate can
2081 The general rule is that only the outermost (= leftmost) predicate can
2069 enforce its ordering requirement. The other predicates should take the
2082 enforce its ordering requirement. The other predicates should take the
2070 ordering defined by it.
2083 ordering defined by it.
2071
2084
2072 'A & B' should follow the order of 'A':
2085 'A & B' should follow the order of 'A':
2073
2086
2074 $ log '2:0 & 0::2'
2087 $ log '2:0 & 0::2'
2075 2
2088 2
2076 1
2089 1
2077 0
2090 0
2078
2091
2079 'head()' combines sets in right order:
2092 'head()' combines sets in right order:
2080
2093
2081 $ log '2:0 & head()'
2094 $ log '2:0 & head()'
2082 2
2095 2
2083 1
2096 1
2084 0
2097 0
2085
2098
2086 'x:y' takes ordering parameter into account:
2099 'x:y' takes ordering parameter into account:
2087
2100
2088 $ try -p optimized '3:0 & 0:3 & not 2:1'
2101 $ try -p optimized '3:0 & 0:3 & not 2:1'
2089 * optimized:
2102 * optimized:
2090 (difference
2103 (difference
2091 (and
2104 (and
2092 (range
2105 (range
2093 (symbol '3')
2106 (symbol '3')
2094 (symbol '0'))
2107 (symbol '0'))
2095 (range
2108 (range
2096 (symbol '0')
2109 (symbol '0')
2097 (symbol '3')))
2110 (symbol '3')))
2098 (range
2111 (range
2099 (symbol '2')
2112 (symbol '2')
2100 (symbol '1')))
2113 (symbol '1')))
2101 * set:
2114 * set:
2102 <filteredset
2115 <filteredset
2103 <filteredset
2116 <filteredset
2104 <spanset- 0:4>,
2117 <spanset- 0:4>,
2105 <spanset+ 0:4>>,
2118 <spanset+ 0:4>>,
2106 <not
2119 <not
2107 <spanset+ 1:3>>>
2120 <spanset+ 1:3>>>
2108 3
2121 3
2109 0
2122 0
2110
2123
2111 'a + b', which is optimized to '_list(a b)', should take the ordering of
2124 'a + b', which is optimized to '_list(a b)', should take the ordering of
2112 the left expression:
2125 the left expression:
2113
2126
2114 $ try --optimize '2:0 & (0 + 1 + 2)'
2127 $ try --optimize '2:0 & (0 + 1 + 2)'
2115 (and
2128 (and
2116 (range
2129 (range
2117 (symbol '2')
2130 (symbol '2')
2118 (symbol '0'))
2131 (symbol '0'))
2119 (group
2132 (group
2120 (or
2133 (or
2121 (list
2134 (list
2122 (symbol '0')
2135 (symbol '0')
2123 (symbol '1')
2136 (symbol '1')
2124 (symbol '2')))))
2137 (symbol '2')))))
2125 * optimized:
2138 * optimized:
2126 (and
2139 (and
2127 (range
2140 (range
2128 (symbol '2')
2141 (symbol '2')
2129 (symbol '0'))
2142 (symbol '0'))
2130 (func
2143 (func
2131 (symbol '_list')
2144 (symbol '_list')
2132 (string '0\x001\x002')))
2145 (string '0\x001\x002')))
2133 * set:
2146 * set:
2134 <filteredset
2147 <filteredset
2135 <spanset- 0:3>,
2148 <spanset- 0:3>,
2136 <baseset [0, 1, 2]>>
2149 <baseset [0, 1, 2]>>
2137 2
2150 2
2138 1
2151 1
2139 0
2152 0
2140
2153
2141 'A + B' should take the ordering of the left expression:
2154 'A + B' should take the ordering of the left expression:
2142
2155
2143 $ try --optimize '2:0 & (0:1 + 2)'
2156 $ try --optimize '2:0 & (0:1 + 2)'
2144 (and
2157 (and
2145 (range
2158 (range
2146 (symbol '2')
2159 (symbol '2')
2147 (symbol '0'))
2160 (symbol '0'))
2148 (group
2161 (group
2149 (or
2162 (or
2150 (list
2163 (list
2151 (range
2164 (range
2152 (symbol '0')
2165 (symbol '0')
2153 (symbol '1'))
2166 (symbol '1'))
2154 (symbol '2')))))
2167 (symbol '2')))))
2155 * optimized:
2168 * optimized:
2156 (and
2169 (and
2157 (range
2170 (range
2158 (symbol '2')
2171 (symbol '2')
2159 (symbol '0'))
2172 (symbol '0'))
2160 (or
2173 (or
2161 (list
2174 (list
2162 (range
2175 (range
2163 (symbol '0')
2176 (symbol '0')
2164 (symbol '1'))
2177 (symbol '1'))
2165 (symbol '2'))))
2178 (symbol '2'))))
2166 * set:
2179 * set:
2167 <filteredset
2180 <filteredset
2168 <spanset- 0:3>,
2181 <spanset- 0:3>,
2169 <addset
2182 <addset
2170 <spanset+ 0:2>,
2183 <spanset+ 0:2>,
2171 <baseset [2]>>>
2184 <baseset [2]>>>
2172 2
2185 2
2173 1
2186 1
2174 0
2187 0
2175
2188
2176 '_intlist(a b)' should behave like 'a + b':
2189 '_intlist(a b)' should behave like 'a + b':
2177
2190
2178 $ trylist --optimize '2:0 & %ld' 0 1 2
2191 $ trylist --optimize '2:0 & %ld' 0 1 2
2179 (and
2192 (and
2180 (range
2193 (range
2181 (symbol '2')
2194 (symbol '2')
2182 (symbol '0'))
2195 (symbol '0'))
2183 (func
2196 (func
2184 (symbol '_intlist')
2197 (symbol '_intlist')
2185 (string '0\x001\x002')))
2198 (string '0\x001\x002')))
2186 * optimized:
2199 * optimized:
2187 (andsmally
2200 (andsmally
2188 (range
2201 (range
2189 (symbol '2')
2202 (symbol '2')
2190 (symbol '0'))
2203 (symbol '0'))
2191 (func
2204 (func
2192 (symbol '_intlist')
2205 (symbol '_intlist')
2193 (string '0\x001\x002')))
2206 (string '0\x001\x002')))
2194 * set:
2207 * set:
2195 <filteredset
2208 <filteredset
2196 <spanset- 0:3>,
2209 <spanset- 0:3>,
2197 <baseset+ [0, 1, 2]>>
2210 <baseset+ [0, 1, 2]>>
2198 2
2211 2
2199 1
2212 1
2200 0
2213 0
2201
2214
2202 $ trylist --optimize '%ld & 2:0' 0 2 1
2215 $ trylist --optimize '%ld & 2:0' 0 2 1
2203 (and
2216 (and
2204 (func
2217 (func
2205 (symbol '_intlist')
2218 (symbol '_intlist')
2206 (string '0\x002\x001'))
2219 (string '0\x002\x001'))
2207 (range
2220 (range
2208 (symbol '2')
2221 (symbol '2')
2209 (symbol '0')))
2222 (symbol '0')))
2210 * optimized:
2223 * optimized:
2211 (and
2224 (and
2212 (func
2225 (func
2213 (symbol '_intlist')
2226 (symbol '_intlist')
2214 (string '0\x002\x001'))
2227 (string '0\x002\x001'))
2215 (range
2228 (range
2216 (symbol '2')
2229 (symbol '2')
2217 (symbol '0')))
2230 (symbol '0')))
2218 * set:
2231 * set:
2219 <filteredset
2232 <filteredset
2220 <baseset [0, 2, 1]>,
2233 <baseset [0, 2, 1]>,
2221 <spanset- 0:3>>
2234 <spanset- 0:3>>
2222 0
2235 0
2223 2
2236 2
2224 1
2237 1
2225
2238
2226 '_hexlist(a b)' should behave like 'a + b':
2239 '_hexlist(a b)' should behave like 'a + b':
2227
2240
2228 $ trylist --optimize --bin '2:0 & %ln' `hg log -T '{node} ' -r0:2`
2241 $ trylist --optimize --bin '2:0 & %ln' `hg log -T '{node} ' -r0:2`
2229 (and
2242 (and
2230 (range
2243 (range
2231 (symbol '2')
2244 (symbol '2')
2232 (symbol '0'))
2245 (symbol '0'))
2233 (func
2246 (func
2234 (symbol '_hexlist')
2247 (symbol '_hexlist')
2235 (string '*'))) (glob)
2248 (string '*'))) (glob)
2236 * optimized:
2249 * optimized:
2237 (and
2250 (and
2238 (range
2251 (range
2239 (symbol '2')
2252 (symbol '2')
2240 (symbol '0'))
2253 (symbol '0'))
2241 (func
2254 (func
2242 (symbol '_hexlist')
2255 (symbol '_hexlist')
2243 (string '*'))) (glob)
2256 (string '*'))) (glob)
2244 * set:
2257 * set:
2245 <filteredset
2258 <filteredset
2246 <spanset- 0:3>,
2259 <spanset- 0:3>,
2247 <baseset [0, 1, 2]>>
2260 <baseset [0, 1, 2]>>
2248 2
2261 2
2249 1
2262 1
2250 0
2263 0
2251
2264
2252 $ trylist --optimize --bin '%ln & 2:0' `hg log -T '{node} ' -r0+2+1`
2265 $ trylist --optimize --bin '%ln & 2:0' `hg log -T '{node} ' -r0+2+1`
2253 (and
2266 (and
2254 (func
2267 (func
2255 (symbol '_hexlist')
2268 (symbol '_hexlist')
2256 (string '*')) (glob)
2269 (string '*')) (glob)
2257 (range
2270 (range
2258 (symbol '2')
2271 (symbol '2')
2259 (symbol '0')))
2272 (symbol '0')))
2260 * optimized:
2273 * optimized:
2261 (andsmally
2274 (andsmally
2262 (func
2275 (func
2263 (symbol '_hexlist')
2276 (symbol '_hexlist')
2264 (string '*')) (glob)
2277 (string '*')) (glob)
2265 (range
2278 (range
2266 (symbol '2')
2279 (symbol '2')
2267 (symbol '0')))
2280 (symbol '0')))
2268 * set:
2281 * set:
2269 <baseset [0, 2, 1]>
2282 <baseset [0, 2, 1]>
2270 0
2283 0
2271 2
2284 2
2272 1
2285 1
2273
2286
2274 '_list' should not go through the slow follow-order path if order doesn't
2287 '_list' should not go through the slow follow-order path if order doesn't
2275 matter:
2288 matter:
2276
2289
2277 $ try -p optimized '2:0 & not (0 + 1)'
2290 $ try -p optimized '2:0 & not (0 + 1)'
2278 * optimized:
2291 * optimized:
2279 (difference
2292 (difference
2280 (range
2293 (range
2281 (symbol '2')
2294 (symbol '2')
2282 (symbol '0'))
2295 (symbol '0'))
2283 (func
2296 (func
2284 (symbol '_list')
2297 (symbol '_list')
2285 (string '0\x001')))
2298 (string '0\x001')))
2286 * set:
2299 * set:
2287 <filteredset
2300 <filteredset
2288 <spanset- 0:3>,
2301 <spanset- 0:3>,
2289 <not
2302 <not
2290 <baseset [0, 1]>>>
2303 <baseset [0, 1]>>>
2291 2
2304 2
2292
2305
2293 $ try -p optimized '2:0 & not (0:2 & (0 + 1))'
2306 $ try -p optimized '2:0 & not (0:2 & (0 + 1))'
2294 * optimized:
2307 * optimized:
2295 (difference
2308 (difference
2296 (range
2309 (range
2297 (symbol '2')
2310 (symbol '2')
2298 (symbol '0'))
2311 (symbol '0'))
2299 (and
2312 (and
2300 (range
2313 (range
2301 (symbol '0')
2314 (symbol '0')
2302 (symbol '2'))
2315 (symbol '2'))
2303 (func
2316 (func
2304 (symbol '_list')
2317 (symbol '_list')
2305 (string '0\x001'))))
2318 (string '0\x001'))))
2306 * set:
2319 * set:
2307 <filteredset
2320 <filteredset
2308 <spanset- 0:3>,
2321 <spanset- 0:3>,
2309 <not
2322 <not
2310 <baseset [0, 1]>>>
2323 <baseset [0, 1]>>>
2311 2
2324 2
2312
2325
2313 because 'present()' does nothing other than suppressing an error, the
2326 because 'present()' does nothing other than suppressing an error, the
2314 ordering requirement should be forwarded to the nested expression
2327 ordering requirement should be forwarded to the nested expression
2315
2328
2316 $ try -p optimized 'present(2 + 0 + 1)'
2329 $ try -p optimized 'present(2 + 0 + 1)'
2317 * optimized:
2330 * optimized:
2318 (func
2331 (func
2319 (symbol 'present')
2332 (symbol 'present')
2320 (func
2333 (func
2321 (symbol '_list')
2334 (symbol '_list')
2322 (string '2\x000\x001')))
2335 (string '2\x000\x001')))
2323 * set:
2336 * set:
2324 <baseset [2, 0, 1]>
2337 <baseset [2, 0, 1]>
2325 2
2338 2
2326 0
2339 0
2327 1
2340 1
2328
2341
2329 $ try --optimize '2:0 & present(0 + 1 + 2)'
2342 $ try --optimize '2:0 & present(0 + 1 + 2)'
2330 (and
2343 (and
2331 (range
2344 (range
2332 (symbol '2')
2345 (symbol '2')
2333 (symbol '0'))
2346 (symbol '0'))
2334 (func
2347 (func
2335 (symbol 'present')
2348 (symbol 'present')
2336 (or
2349 (or
2337 (list
2350 (list
2338 (symbol '0')
2351 (symbol '0')
2339 (symbol '1')
2352 (symbol '1')
2340 (symbol '2')))))
2353 (symbol '2')))))
2341 * optimized:
2354 * optimized:
2342 (and
2355 (and
2343 (range
2356 (range
2344 (symbol '2')
2357 (symbol '2')
2345 (symbol '0'))
2358 (symbol '0'))
2346 (func
2359 (func
2347 (symbol 'present')
2360 (symbol 'present')
2348 (func
2361 (func
2349 (symbol '_list')
2362 (symbol '_list')
2350 (string '0\x001\x002'))))
2363 (string '0\x001\x002'))))
2351 * set:
2364 * set:
2352 <filteredset
2365 <filteredset
2353 <spanset- 0:3>,
2366 <spanset- 0:3>,
2354 <baseset [0, 1, 2]>>
2367 <baseset [0, 1, 2]>>
2355 2
2368 2
2356 1
2369 1
2357 0
2370 0
2358
2371
2359 'reverse()' should take effect only if it is the outermost expression:
2372 'reverse()' should take effect only if it is the outermost expression:
2360
2373
2361 $ try --optimize '0:2 & reverse(all())'
2374 $ try --optimize '0:2 & reverse(all())'
2362 (and
2375 (and
2363 (range
2376 (range
2364 (symbol '0')
2377 (symbol '0')
2365 (symbol '2'))
2378 (symbol '2'))
2366 (func
2379 (func
2367 (symbol 'reverse')
2380 (symbol 'reverse')
2368 (func
2381 (func
2369 (symbol 'all')
2382 (symbol 'all')
2370 None)))
2383 None)))
2371 * optimized:
2384 * optimized:
2372 (and
2385 (and
2373 (range
2386 (range
2374 (symbol '0')
2387 (symbol '0')
2375 (symbol '2'))
2388 (symbol '2'))
2376 (func
2389 (func
2377 (symbol 'reverse')
2390 (symbol 'reverse')
2378 (func
2391 (func
2379 (symbol 'all')
2392 (symbol 'all')
2380 None)))
2393 None)))
2381 * set:
2394 * set:
2382 <filteredset
2395 <filteredset
2383 <spanset+ 0:3>,
2396 <spanset+ 0:3>,
2384 <spanset+ 0:10>>
2397 <spanset+ 0:10>>
2385 0
2398 0
2386 1
2399 1
2387 2
2400 2
2388
2401
2389 'sort()' should take effect only if it is the outermost expression:
2402 'sort()' should take effect only if it is the outermost expression:
2390
2403
2391 $ try --optimize '0:2 & sort(all(), -rev)'
2404 $ try --optimize '0:2 & sort(all(), -rev)'
2392 (and
2405 (and
2393 (range
2406 (range
2394 (symbol '0')
2407 (symbol '0')
2395 (symbol '2'))
2408 (symbol '2'))
2396 (func
2409 (func
2397 (symbol 'sort')
2410 (symbol 'sort')
2398 (list
2411 (list
2399 (func
2412 (func
2400 (symbol 'all')
2413 (symbol 'all')
2401 None)
2414 None)
2402 (negate
2415 (negate
2403 (symbol 'rev')))))
2416 (symbol 'rev')))))
2404 * optimized:
2417 * optimized:
2405 (and
2418 (and
2406 (range
2419 (range
2407 (symbol '0')
2420 (symbol '0')
2408 (symbol '2'))
2421 (symbol '2'))
2409 (func
2422 (func
2410 (symbol 'sort')
2423 (symbol 'sort')
2411 (list
2424 (list
2412 (func
2425 (func
2413 (symbol 'all')
2426 (symbol 'all')
2414 None)
2427 None)
2415 (string '-rev'))))
2428 (string '-rev'))))
2416 * set:
2429 * set:
2417 <filteredset
2430 <filteredset
2418 <spanset+ 0:3>,
2431 <spanset+ 0:3>,
2419 <spanset+ 0:10>>
2432 <spanset+ 0:10>>
2420 0
2433 0
2421 1
2434 1
2422 2
2435 2
2423
2436
2424 invalid argument passed to noop sort():
2437 invalid argument passed to noop sort():
2425
2438
2426 $ log '0:2 & sort()'
2439 $ log '0:2 & sort()'
2427 hg: parse error: sort requires one or two arguments
2440 hg: parse error: sort requires one or two arguments
2428 [255]
2441 [255]
2429 $ log '0:2 & sort(all(), -invalid)'
2442 $ log '0:2 & sort(all(), -invalid)'
2430 hg: parse error: unknown sort key '-invalid'
2443 hg: parse error: unknown sort key '-invalid'
2431 [255]
2444 [255]
2432
2445
2433 for 'A & f(B)', 'B' should not be affected by the order of 'A':
2446 for 'A & f(B)', 'B' should not be affected by the order of 'A':
2434
2447
2435 $ try --optimize '2:0 & first(1 + 0 + 2)'
2448 $ try --optimize '2:0 & first(1 + 0 + 2)'
2436 (and
2449 (and
2437 (range
2450 (range
2438 (symbol '2')
2451 (symbol '2')
2439 (symbol '0'))
2452 (symbol '0'))
2440 (func
2453 (func
2441 (symbol 'first')
2454 (symbol 'first')
2442 (or
2455 (or
2443 (list
2456 (list
2444 (symbol '1')
2457 (symbol '1')
2445 (symbol '0')
2458 (symbol '0')
2446 (symbol '2')))))
2459 (symbol '2')))))
2447 * optimized:
2460 * optimized:
2448 (and
2461 (and
2449 (range
2462 (range
2450 (symbol '2')
2463 (symbol '2')
2451 (symbol '0'))
2464 (symbol '0'))
2452 (func
2465 (func
2453 (symbol 'first')
2466 (symbol 'first')
2454 (func
2467 (func
2455 (symbol '_list')
2468 (symbol '_list')
2456 (string '1\x000\x002'))))
2469 (string '1\x000\x002'))))
2457 * set:
2470 * set:
2458 <filteredset
2471 <filteredset
2459 <baseset [1]>,
2472 <baseset [1]>,
2460 <spanset- 0:3>>
2473 <spanset- 0:3>>
2461 1
2474 1
2462
2475
2463 $ try --optimize '2:0 & not last(0 + 2 + 1)'
2476 $ try --optimize '2:0 & not last(0 + 2 + 1)'
2464 (and
2477 (and
2465 (range
2478 (range
2466 (symbol '2')
2479 (symbol '2')
2467 (symbol '0'))
2480 (symbol '0'))
2468 (not
2481 (not
2469 (func
2482 (func
2470 (symbol 'last')
2483 (symbol 'last')
2471 (or
2484 (or
2472 (list
2485 (list
2473 (symbol '0')
2486 (symbol '0')
2474 (symbol '2')
2487 (symbol '2')
2475 (symbol '1'))))))
2488 (symbol '1'))))))
2476 * optimized:
2489 * optimized:
2477 (difference
2490 (difference
2478 (range
2491 (range
2479 (symbol '2')
2492 (symbol '2')
2480 (symbol '0'))
2493 (symbol '0'))
2481 (func
2494 (func
2482 (symbol 'last')
2495 (symbol 'last')
2483 (func
2496 (func
2484 (symbol '_list')
2497 (symbol '_list')
2485 (string '0\x002\x001'))))
2498 (string '0\x002\x001'))))
2486 * set:
2499 * set:
2487 <filteredset
2500 <filteredset
2488 <spanset- 0:3>,
2501 <spanset- 0:3>,
2489 <not
2502 <not
2490 <baseset [1]>>>
2503 <baseset [1]>>>
2491 2
2504 2
2492 0
2505 0
2493
2506
2494 for 'A & (op)(B)', 'B' should not be affected by the order of 'A':
2507 for 'A & (op)(B)', 'B' should not be affected by the order of 'A':
2495
2508
2496 $ try --optimize '2:0 & (1 + 0 + 2):(0 + 2 + 1)'
2509 $ try --optimize '2:0 & (1 + 0 + 2):(0 + 2 + 1)'
2497 (and
2510 (and
2498 (range
2511 (range
2499 (symbol '2')
2512 (symbol '2')
2500 (symbol '0'))
2513 (symbol '0'))
2501 (range
2514 (range
2502 (group
2515 (group
2503 (or
2516 (or
2504 (list
2517 (list
2505 (symbol '1')
2518 (symbol '1')
2506 (symbol '0')
2519 (symbol '0')
2507 (symbol '2'))))
2520 (symbol '2'))))
2508 (group
2521 (group
2509 (or
2522 (or
2510 (list
2523 (list
2511 (symbol '0')
2524 (symbol '0')
2512 (symbol '2')
2525 (symbol '2')
2513 (symbol '1'))))))
2526 (symbol '1'))))))
2514 * optimized:
2527 * optimized:
2515 (and
2528 (and
2516 (range
2529 (range
2517 (symbol '2')
2530 (symbol '2')
2518 (symbol '0'))
2531 (symbol '0'))
2519 (range
2532 (range
2520 (func
2533 (func
2521 (symbol '_list')
2534 (symbol '_list')
2522 (string '1\x000\x002'))
2535 (string '1\x000\x002'))
2523 (func
2536 (func
2524 (symbol '_list')
2537 (symbol '_list')
2525 (string '0\x002\x001'))))
2538 (string '0\x002\x001'))))
2526 * set:
2539 * set:
2527 <filteredset
2540 <filteredset
2528 <spanset- 0:3>,
2541 <spanset- 0:3>,
2529 <baseset [1]>>
2542 <baseset [1]>>
2530 1
2543 1
2531
2544
2532 'A & B' can be rewritten as 'flipand(B, A)' by weight.
2545 'A & B' can be rewritten as 'flipand(B, A)' by weight.
2533
2546
2534 $ try --optimize 'contains("glob:*") & (2 + 0 + 1)'
2547 $ try --optimize 'contains("glob:*") & (2 + 0 + 1)'
2535 (and
2548 (and
2536 (func
2549 (func
2537 (symbol 'contains')
2550 (symbol 'contains')
2538 (string 'glob:*'))
2551 (string 'glob:*'))
2539 (group
2552 (group
2540 (or
2553 (or
2541 (list
2554 (list
2542 (symbol '2')
2555 (symbol '2')
2543 (symbol '0')
2556 (symbol '0')
2544 (symbol '1')))))
2557 (symbol '1')))))
2545 * optimized:
2558 * optimized:
2546 (andsmally
2559 (andsmally
2547 (func
2560 (func
2548 (symbol 'contains')
2561 (symbol 'contains')
2549 (string 'glob:*'))
2562 (string 'glob:*'))
2550 (func
2563 (func
2551 (symbol '_list')
2564 (symbol '_list')
2552 (string '2\x000\x001')))
2565 (string '2\x000\x001')))
2553 * set:
2566 * set:
2554 <filteredset
2567 <filteredset
2555 <baseset+ [0, 1, 2]>,
2568 <baseset+ [0, 1, 2]>,
2556 <contains 'glob:*'>>
2569 <contains 'glob:*'>>
2557 0
2570 0
2558 1
2571 1
2559 2
2572 2
2560
2573
2561 and in this example, 'A & B' is rewritten as 'B & A', but 'A' overrides
2574 and in this example, 'A & B' is rewritten as 'B & A', but 'A' overrides
2562 the order appropriately:
2575 the order appropriately:
2563
2576
2564 $ try --optimize 'reverse(contains("glob:*")) & (0 + 2 + 1)'
2577 $ try --optimize 'reverse(contains("glob:*")) & (0 + 2 + 1)'
2565 (and
2578 (and
2566 (func
2579 (func
2567 (symbol 'reverse')
2580 (symbol 'reverse')
2568 (func
2581 (func
2569 (symbol 'contains')
2582 (symbol 'contains')
2570 (string 'glob:*')))
2583 (string 'glob:*')))
2571 (group
2584 (group
2572 (or
2585 (or
2573 (list
2586 (list
2574 (symbol '0')
2587 (symbol '0')
2575 (symbol '2')
2588 (symbol '2')
2576 (symbol '1')))))
2589 (symbol '1')))))
2577 * optimized:
2590 * optimized:
2578 (andsmally
2591 (andsmally
2579 (func
2592 (func
2580 (symbol 'reverse')
2593 (symbol 'reverse')
2581 (func
2594 (func
2582 (symbol 'contains')
2595 (symbol 'contains')
2583 (string 'glob:*')))
2596 (string 'glob:*')))
2584 (func
2597 (func
2585 (symbol '_list')
2598 (symbol '_list')
2586 (string '0\x002\x001')))
2599 (string '0\x002\x001')))
2587 * set:
2600 * set:
2588 <filteredset
2601 <filteredset
2589 <baseset- [0, 1, 2]>,
2602 <baseset- [0, 1, 2]>,
2590 <contains 'glob:*'>>
2603 <contains 'glob:*'>>
2591 2
2604 2
2592 1
2605 1
2593 0
2606 0
2594
2607
2595 test sort revset
2608 test sort revset
2596 --------------------------------------------
2609 --------------------------------------------
2597
2610
2598 test when adding two unordered revsets
2611 test when adding two unordered revsets
2599
2612
2600 $ log 'sort(keyword(issue) or modifies(b))'
2613 $ log 'sort(keyword(issue) or modifies(b))'
2601 4
2614 4
2602 6
2615 6
2603
2616
2604 test when sorting a reversed collection in the same way it is
2617 test when sorting a reversed collection in the same way it is
2605
2618
2606 $ log 'sort(reverse(all()), -rev)'
2619 $ log 'sort(reverse(all()), -rev)'
2607 9
2620 9
2608 8
2621 8
2609 7
2622 7
2610 6
2623 6
2611 5
2624 5
2612 4
2625 4
2613 3
2626 3
2614 2
2627 2
2615 1
2628 1
2616 0
2629 0
2617
2630
2618 test when sorting a reversed collection
2631 test when sorting a reversed collection
2619
2632
2620 $ log 'sort(reverse(all()), rev)'
2633 $ log 'sort(reverse(all()), rev)'
2621 0
2634 0
2622 1
2635 1
2623 2
2636 2
2624 3
2637 3
2625 4
2638 4
2626 5
2639 5
2627 6
2640 6
2628 7
2641 7
2629 8
2642 8
2630 9
2643 9
2631
2644
2632
2645
2633 test sorting two sorted collections in different orders
2646 test sorting two sorted collections in different orders
2634
2647
2635 $ log 'sort(outgoing() or reverse(removes(a)), rev)'
2648 $ log 'sort(outgoing() or reverse(removes(a)), rev)'
2636 2
2649 2
2637 6
2650 6
2638 8
2651 8
2639 9
2652 9
2640
2653
2641 test sorting two sorted collections in different orders backwards
2654 test sorting two sorted collections in different orders backwards
2642
2655
2643 $ log 'sort(outgoing() or reverse(removes(a)), -rev)'
2656 $ log 'sort(outgoing() or reverse(removes(a)), -rev)'
2644 9
2657 9
2645 8
2658 8
2646 6
2659 6
2647 2
2660 2
2648
2661
2649 test empty sort key which is noop
2662 test empty sort key which is noop
2650
2663
2651 $ log 'sort(0 + 2 + 1, "")'
2664 $ log 'sort(0 + 2 + 1, "")'
2652 0
2665 0
2653 2
2666 2
2654 1
2667 1
2655
2668
2656 test invalid sort keys
2669 test invalid sort keys
2657
2670
2658 $ log 'sort(all(), -invalid)'
2671 $ log 'sort(all(), -invalid)'
2659 hg: parse error: unknown sort key '-invalid'
2672 hg: parse error: unknown sort key '-invalid'
2660 [255]
2673 [255]
2661
2674
2662 $ cd ..
2675 $ cd ..
2663
2676
2664 test sorting by multiple keys including variable-length strings
2677 test sorting by multiple keys including variable-length strings
2665
2678
2666 $ hg init sorting
2679 $ hg init sorting
2667 $ cd sorting
2680 $ cd sorting
2668 $ cat <<EOF >> .hg/hgrc
2681 $ cat <<EOF >> .hg/hgrc
2669 > [ui]
2682 > [ui]
2670 > logtemplate = '{rev} {branch|p5}{desc|p5}{author|p5}{date|hgdate}\n'
2683 > logtemplate = '{rev} {branch|p5}{desc|p5}{author|p5}{date|hgdate}\n'
2671 > [templatealias]
2684 > [templatealias]
2672 > p5(s) = pad(s, 5)
2685 > p5(s) = pad(s, 5)
2673 > EOF
2686 > EOF
2674 $ hg branch -qf b12
2687 $ hg branch -qf b12
2675 $ hg ci -m m111 -u u112 -d '111 10800'
2688 $ hg ci -m m111 -u u112 -d '111 10800'
2676 $ hg branch -qf b11
2689 $ hg branch -qf b11
2677 $ hg ci -m m12 -u u111 -d '112 7200'
2690 $ hg ci -m m12 -u u111 -d '112 7200'
2678 $ hg branch -qf b111
2691 $ hg branch -qf b111
2679 $ hg ci -m m11 -u u12 -d '111 3600'
2692 $ hg ci -m m11 -u u12 -d '111 3600'
2680 $ hg branch -qf b112
2693 $ hg branch -qf b112
2681 $ hg ci -m m111 -u u11 -d '120 0'
2694 $ hg ci -m m111 -u u11 -d '120 0'
2682 $ hg branch -qf b111
2695 $ hg branch -qf b111
2683 $ hg ci -m m112 -u u111 -d '110 14400'
2696 $ hg ci -m m112 -u u111 -d '110 14400'
2684 created new head
2697 created new head
2685
2698
2686 compare revisions (has fast path):
2699 compare revisions (has fast path):
2687
2700
2688 $ hg log -r 'sort(all(), rev)'
2701 $ hg log -r 'sort(all(), rev)'
2689 0 b12 m111 u112 111 10800
2702 0 b12 m111 u112 111 10800
2690 1 b11 m12 u111 112 7200
2703 1 b11 m12 u111 112 7200
2691 2 b111 m11 u12 111 3600
2704 2 b111 m11 u12 111 3600
2692 3 b112 m111 u11 120 0
2705 3 b112 m111 u11 120 0
2693 4 b111 m112 u111 110 14400
2706 4 b111 m112 u111 110 14400
2694
2707
2695 $ hg log -r 'sort(all(), -rev)'
2708 $ hg log -r 'sort(all(), -rev)'
2696 4 b111 m112 u111 110 14400
2709 4 b111 m112 u111 110 14400
2697 3 b112 m111 u11 120 0
2710 3 b112 m111 u11 120 0
2698 2 b111 m11 u12 111 3600
2711 2 b111 m11 u12 111 3600
2699 1 b11 m12 u111 112 7200
2712 1 b11 m12 u111 112 7200
2700 0 b12 m111 u112 111 10800
2713 0 b12 m111 u112 111 10800
2701
2714
2702 compare variable-length strings (issue5218):
2715 compare variable-length strings (issue5218):
2703
2716
2704 $ hg log -r 'sort(all(), branch)'
2717 $ hg log -r 'sort(all(), branch)'
2705 1 b11 m12 u111 112 7200
2718 1 b11 m12 u111 112 7200
2706 2 b111 m11 u12 111 3600
2719 2 b111 m11 u12 111 3600
2707 4 b111 m112 u111 110 14400
2720 4 b111 m112 u111 110 14400
2708 3 b112 m111 u11 120 0
2721 3 b112 m111 u11 120 0
2709 0 b12 m111 u112 111 10800
2722 0 b12 m111 u112 111 10800
2710
2723
2711 $ hg log -r 'sort(all(), -branch)'
2724 $ hg log -r 'sort(all(), -branch)'
2712 0 b12 m111 u112 111 10800
2725 0 b12 m111 u112 111 10800
2713 3 b112 m111 u11 120 0
2726 3 b112 m111 u11 120 0
2714 2 b111 m11 u12 111 3600
2727 2 b111 m11 u12 111 3600
2715 4 b111 m112 u111 110 14400
2728 4 b111 m112 u111 110 14400
2716 1 b11 m12 u111 112 7200
2729 1 b11 m12 u111 112 7200
2717
2730
2718 $ hg log -r 'sort(all(), desc)'
2731 $ hg log -r 'sort(all(), desc)'
2719 2 b111 m11 u12 111 3600
2732 2 b111 m11 u12 111 3600
2720 0 b12 m111 u112 111 10800
2733 0 b12 m111 u112 111 10800
2721 3 b112 m111 u11 120 0
2734 3 b112 m111 u11 120 0
2722 4 b111 m112 u111 110 14400
2735 4 b111 m112 u111 110 14400
2723 1 b11 m12 u111 112 7200
2736 1 b11 m12 u111 112 7200
2724
2737
2725 $ hg log -r 'sort(all(), -desc)'
2738 $ hg log -r 'sort(all(), -desc)'
2726 1 b11 m12 u111 112 7200
2739 1 b11 m12 u111 112 7200
2727 4 b111 m112 u111 110 14400
2740 4 b111 m112 u111 110 14400
2728 0 b12 m111 u112 111 10800
2741 0 b12 m111 u112 111 10800
2729 3 b112 m111 u11 120 0
2742 3 b112 m111 u11 120 0
2730 2 b111 m11 u12 111 3600
2743 2 b111 m11 u12 111 3600
2731
2744
2732 $ hg log -r 'sort(all(), user)'
2745 $ hg log -r 'sort(all(), user)'
2733 3 b112 m111 u11 120 0
2746 3 b112 m111 u11 120 0
2734 1 b11 m12 u111 112 7200
2747 1 b11 m12 u111 112 7200
2735 4 b111 m112 u111 110 14400
2748 4 b111 m112 u111 110 14400
2736 0 b12 m111 u112 111 10800
2749 0 b12 m111 u112 111 10800
2737 2 b111 m11 u12 111 3600
2750 2 b111 m11 u12 111 3600
2738
2751
2739 $ hg log -r 'sort(all(), -user)'
2752 $ hg log -r 'sort(all(), -user)'
2740 2 b111 m11 u12 111 3600
2753 2 b111 m11 u12 111 3600
2741 0 b12 m111 u112 111 10800
2754 0 b12 m111 u112 111 10800
2742 1 b11 m12 u111 112 7200
2755 1 b11 m12 u111 112 7200
2743 4 b111 m112 u111 110 14400
2756 4 b111 m112 u111 110 14400
2744 3 b112 m111 u11 120 0
2757 3 b112 m111 u11 120 0
2745
2758
2746 compare dates (tz offset should have no effect):
2759 compare dates (tz offset should have no effect):
2747
2760
2748 $ hg log -r 'sort(all(), date)'
2761 $ hg log -r 'sort(all(), date)'
2749 4 b111 m112 u111 110 14400
2762 4 b111 m112 u111 110 14400
2750 0 b12 m111 u112 111 10800
2763 0 b12 m111 u112 111 10800
2751 2 b111 m11 u12 111 3600
2764 2 b111 m11 u12 111 3600
2752 1 b11 m12 u111 112 7200
2765 1 b11 m12 u111 112 7200
2753 3 b112 m111 u11 120 0
2766 3 b112 m111 u11 120 0
2754
2767
2755 $ hg log -r 'sort(all(), -date)'
2768 $ hg log -r 'sort(all(), -date)'
2756 3 b112 m111 u11 120 0
2769 3 b112 m111 u11 120 0
2757 1 b11 m12 u111 112 7200
2770 1 b11 m12 u111 112 7200
2758 0 b12 m111 u112 111 10800
2771 0 b12 m111 u112 111 10800
2759 2 b111 m11 u12 111 3600
2772 2 b111 m11 u12 111 3600
2760 4 b111 m112 u111 110 14400
2773 4 b111 m112 u111 110 14400
2761
2774
2762 be aware that 'sort(x, -k)' is not exactly the same as 'reverse(sort(x, k))'
2775 be aware that 'sort(x, -k)' is not exactly the same as 'reverse(sort(x, k))'
2763 because '-k' reverses the comparison, not the list itself:
2776 because '-k' reverses the comparison, not the list itself:
2764
2777
2765 $ hg log -r 'sort(0 + 2, date)'
2778 $ hg log -r 'sort(0 + 2, date)'
2766 0 b12 m111 u112 111 10800
2779 0 b12 m111 u112 111 10800
2767 2 b111 m11 u12 111 3600
2780 2 b111 m11 u12 111 3600
2768
2781
2769 $ hg log -r 'sort(0 + 2, -date)'
2782 $ hg log -r 'sort(0 + 2, -date)'
2770 0 b12 m111 u112 111 10800
2783 0 b12 m111 u112 111 10800
2771 2 b111 m11 u12 111 3600
2784 2 b111 m11 u12 111 3600
2772
2785
2773 $ hg log -r 'reverse(sort(0 + 2, date))'
2786 $ hg log -r 'reverse(sort(0 + 2, date))'
2774 2 b111 m11 u12 111 3600
2787 2 b111 m11 u12 111 3600
2775 0 b12 m111 u112 111 10800
2788 0 b12 m111 u112 111 10800
2776
2789
2777 sort by multiple keys:
2790 sort by multiple keys:
2778
2791
2779 $ hg log -r 'sort(all(), "branch -rev")'
2792 $ hg log -r 'sort(all(), "branch -rev")'
2780 1 b11 m12 u111 112 7200
2793 1 b11 m12 u111 112 7200
2781 4 b111 m112 u111 110 14400
2794 4 b111 m112 u111 110 14400
2782 2 b111 m11 u12 111 3600
2795 2 b111 m11 u12 111 3600
2783 3 b112 m111 u11 120 0
2796 3 b112 m111 u11 120 0
2784 0 b12 m111 u112 111 10800
2797 0 b12 m111 u112 111 10800
2785
2798
2786 $ hg log -r 'sort(all(), "-desc -date")'
2799 $ hg log -r 'sort(all(), "-desc -date")'
2787 1 b11 m12 u111 112 7200
2800 1 b11 m12 u111 112 7200
2788 4 b111 m112 u111 110 14400
2801 4 b111 m112 u111 110 14400
2789 3 b112 m111 u11 120 0
2802 3 b112 m111 u11 120 0
2790 0 b12 m111 u112 111 10800
2803 0 b12 m111 u112 111 10800
2791 2 b111 m11 u12 111 3600
2804 2 b111 m11 u12 111 3600
2792
2805
2793 $ hg log -r 'sort(all(), "user -branch date rev")'
2806 $ hg log -r 'sort(all(), "user -branch date rev")'
2794 3 b112 m111 u11 120 0
2807 3 b112 m111 u11 120 0
2795 4 b111 m112 u111 110 14400
2808 4 b111 m112 u111 110 14400
2796 1 b11 m12 u111 112 7200
2809 1 b11 m12 u111 112 7200
2797 0 b12 m111 u112 111 10800
2810 0 b12 m111 u112 111 10800
2798 2 b111 m11 u12 111 3600
2811 2 b111 m11 u12 111 3600
2799
2812
2800 toposort prioritises graph branches
2813 toposort prioritises graph branches
2801
2814
2802 $ hg up 2
2815 $ hg up 2
2803 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
2816 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
2804 $ touch a
2817 $ touch a
2805 $ hg addremove
2818 $ hg addremove
2806 adding a
2819 adding a
2807 $ hg ci -m 't1' -u 'tu' -d '130 0'
2820 $ hg ci -m 't1' -u 'tu' -d '130 0'
2808 created new head
2821 created new head
2809 $ echo 'a' >> a
2822 $ echo 'a' >> a
2810 $ hg ci -m 't2' -u 'tu' -d '130 0'
2823 $ hg ci -m 't2' -u 'tu' -d '130 0'
2811 $ hg book book1
2824 $ hg book book1
2812 $ hg up 4
2825 $ hg up 4
2813 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
2826 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
2814 (leaving bookmark book1)
2827 (leaving bookmark book1)
2815 $ touch a
2828 $ touch a
2816 $ hg addremove
2829 $ hg addremove
2817 adding a
2830 adding a
2818 $ hg ci -m 't3' -u 'tu' -d '130 0'
2831 $ hg ci -m 't3' -u 'tu' -d '130 0'
2819
2832
2820 $ hg log -r 'sort(all(), topo)'
2833 $ hg log -r 'sort(all(), topo)'
2821 7 b111 t3 tu 130 0
2834 7 b111 t3 tu 130 0
2822 4 b111 m112 u111 110 14400
2835 4 b111 m112 u111 110 14400
2823 3 b112 m111 u11 120 0
2836 3 b112 m111 u11 120 0
2824 6 b111 t2 tu 130 0
2837 6 b111 t2 tu 130 0
2825 5 b111 t1 tu 130 0
2838 5 b111 t1 tu 130 0
2826 2 b111 m11 u12 111 3600
2839 2 b111 m11 u12 111 3600
2827 1 b11 m12 u111 112 7200
2840 1 b11 m12 u111 112 7200
2828 0 b12 m111 u112 111 10800
2841 0 b12 m111 u112 111 10800
2829
2842
2830 $ hg log -r 'sort(all(), -topo)'
2843 $ hg log -r 'sort(all(), -topo)'
2831 0 b12 m111 u112 111 10800
2844 0 b12 m111 u112 111 10800
2832 1 b11 m12 u111 112 7200
2845 1 b11 m12 u111 112 7200
2833 2 b111 m11 u12 111 3600
2846 2 b111 m11 u12 111 3600
2834 5 b111 t1 tu 130 0
2847 5 b111 t1 tu 130 0
2835 6 b111 t2 tu 130 0
2848 6 b111 t2 tu 130 0
2836 3 b112 m111 u11 120 0
2849 3 b112 m111 u11 120 0
2837 4 b111 m112 u111 110 14400
2850 4 b111 m112 u111 110 14400
2838 7 b111 t3 tu 130 0
2851 7 b111 t3 tu 130 0
2839
2852
2840 $ hg log -r 'sort(all(), topo, topo.firstbranch=book1)'
2853 $ hg log -r 'sort(all(), topo, topo.firstbranch=book1)'
2841 6 b111 t2 tu 130 0
2854 6 b111 t2 tu 130 0
2842 5 b111 t1 tu 130 0
2855 5 b111 t1 tu 130 0
2843 7 b111 t3 tu 130 0
2856 7 b111 t3 tu 130 0
2844 4 b111 m112 u111 110 14400
2857 4 b111 m112 u111 110 14400
2845 3 b112 m111 u11 120 0
2858 3 b112 m111 u11 120 0
2846 2 b111 m11 u12 111 3600
2859 2 b111 m11 u12 111 3600
2847 1 b11 m12 u111 112 7200
2860 1 b11 m12 u111 112 7200
2848 0 b12 m111 u112 111 10800
2861 0 b12 m111 u112 111 10800
2849
2862
2850 topographical sorting can't be combined with other sort keys, and you can't
2863 topographical sorting can't be combined with other sort keys, and you can't
2851 use the topo.firstbranch option when topo sort is not active:
2864 use the topo.firstbranch option when topo sort is not active:
2852
2865
2853 $ hg log -r 'sort(all(), "topo user")'
2866 $ hg log -r 'sort(all(), "topo user")'
2854 hg: parse error: topo sort order cannot be combined with other sort keys
2867 hg: parse error: topo sort order cannot be combined with other sort keys
2855 [255]
2868 [255]
2856
2869
2857 $ hg log -r 'sort(all(), user, topo.firstbranch=book1)'
2870 $ hg log -r 'sort(all(), user, topo.firstbranch=book1)'
2858 hg: parse error: topo.firstbranch can only be used when using the topo sort key
2871 hg: parse error: topo.firstbranch can only be used when using the topo sort key
2859 [255]
2872 [255]
2860
2873
2861 topo.firstbranch should accept any kind of expressions:
2874 topo.firstbranch should accept any kind of expressions:
2862
2875
2863 $ hg log -r 'sort(0, topo, topo.firstbranch=(book1))'
2876 $ hg log -r 'sort(0, topo, topo.firstbranch=(book1))'
2864 0 b12 m111 u112 111 10800
2877 0 b12 m111 u112 111 10800
2865
2878
2866 $ cd ..
2879 $ cd ..
2867 $ cd repo
2880 $ cd repo
2868
2881
2869 test multiline revset with errors
2882 test multiline revset with errors
2870
2883
2871 $ echo > multiline-revset
2884 $ echo > multiline-revset
2872 $ echo '. +' >> multiline-revset
2885 $ echo '. +' >> multiline-revset
2873 $ echo '.^ +' >> multiline-revset
2886 $ echo '.^ +' >> multiline-revset
2874 $ hg log -r "`cat multiline-revset`"
2887 $ hg log -r "`cat multiline-revset`"
2875 hg: parse error at 9: not a prefix: end
2888 hg: parse error at 9: not a prefix: end
2876 ( . + .^ +
2889 ( . + .^ +
2877 ^ here)
2890 ^ here)
2878 [255]
2891 [255]
2879 $ hg debugrevspec -v 'revset(first(rev(0)))' -p all
2892 $ hg debugrevspec -v 'revset(first(rev(0)))' -p all
2880 * parsed:
2893 * parsed:
2881 (func
2894 (func
2882 (symbol 'revset')
2895 (symbol 'revset')
2883 (func
2896 (func
2884 (symbol 'first')
2897 (symbol 'first')
2885 (func
2898 (func
2886 (symbol 'rev')
2899 (symbol 'rev')
2887 (symbol '0'))))
2900 (symbol '0'))))
2888 * expanded:
2901 * expanded:
2889 (func
2902 (func
2890 (symbol 'revset')
2903 (symbol 'revset')
2891 (func
2904 (func
2892 (symbol 'first')
2905 (symbol 'first')
2893 (func
2906 (func
2894 (symbol 'rev')
2907 (symbol 'rev')
2895 (symbol '0'))))
2908 (symbol '0'))))
2896 * concatenated:
2909 * concatenated:
2897 (func
2910 (func
2898 (symbol 'revset')
2911 (symbol 'revset')
2899 (func
2912 (func
2900 (symbol 'first')
2913 (symbol 'first')
2901 (func
2914 (func
2902 (symbol 'rev')
2915 (symbol 'rev')
2903 (symbol '0'))))
2916 (symbol '0'))))
2904 * analyzed:
2917 * analyzed:
2905 (func
2918 (func
2906 (symbol 'first')
2919 (symbol 'first')
2907 (func
2920 (func
2908 (symbol 'rev')
2921 (symbol 'rev')
2909 (symbol '0')))
2922 (symbol '0')))
2910 * optimized:
2923 * optimized:
2911 (func
2924 (func
2912 (symbol 'first')
2925 (symbol 'first')
2913 (func
2926 (func
2914 (symbol 'rev')
2927 (symbol 'rev')
2915 (symbol '0')))
2928 (symbol '0')))
2916 * set:
2929 * set:
2917 <baseset+ [0]>
2930 <baseset+ [0]>
2918 0
2931 0
General Comments 0
You need to be logged in to leave comments. Login now