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