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