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