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