Debian Codegraph @

tests/test-revset2.t

raw
1 $ HGENCODING=utf-8
2 $ export HGENCODING
3 $ cat >> $HGRCPATH << EOF
4 > [extensions]
5 > drawdag=$TESTDIR/drawdag.py
6 > EOF
7
8 $ try() {
9 > hg debugrevspec --debug "$@"
10 > }
11
12 $ log() {
13 > hg log --template '{rev}\n' -r "$1"
14 > }
15
16 $ hg init repo
17 $ cd repo
18
19 $ echo a > a
20 $ hg branch a
21 marked working directory as branch a
22 (branches are permanent and global, did you want a bookmark?)
23 $ hg ci -Aqm0
24
25 $ echo b > b
26 $ hg branch b
27 marked working directory as branch b
28 $ hg ci -Aqm1
29
30 $ rm a
31 $ hg branch a-b-c-
32 marked working directory as branch a-b-c-
33 $ hg ci -Aqm2 -u Bob
34
35 $ hg log -r "extra('branch', 'a-b-c-')" --template '{rev}\n'
36 2
37 $ hg log -r "extra('branch')" --template '{rev}\n'
38 0
39 1
40 2
41 $ hg log -r "extra('branch', 're:a')" --template '{rev} {branch}\n'
42 0 a
43 2 a-b-c-
44
45 $ hg co 1
46 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
47 $ hg branch +a+b+c+
48 marked working directory as branch +a+b+c+
49 $ hg ci -Aqm3
50
51 $ hg co 2 # interleave
52 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
53 $ echo bb > b
54 $ hg branch -- -a-b-c-
55 marked working directory as branch -a-b-c-
56 $ hg ci -Aqm4 -d "May 12 2005"
57
58 $ hg co 3
59 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
60 $ hg branch !a/b/c/
61 marked working directory as branch !a/b/c/
62 $ hg ci -Aqm"5 bug"
63
64 $ hg merge 4
65 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
66 (branch merge, don't forget to commit)
67 $ hg branch _a_b_c_
68 marked working directory as branch _a_b_c_
69 $ hg ci -Aqm"6 issue619"
70
71 $ hg branch .a.b.c.
72 marked working directory as branch .a.b.c.
73 $ hg ci -Aqm7
74
75 $ hg branch all
76 marked working directory as branch all
77
78 $ hg co 4
79 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
80 $ hg branch é
81 marked working directory as branch \xc3\xa9 (esc)
82 $ hg ci -Aqm9
83
84 $ hg tag -r6 1.0
85 $ hg bookmark -r6 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
86
87 $ hg clone --quiet -U -r 7 . ../remote1
88 $ hg clone --quiet -U -r 8 . ../remote2
89 $ echo "[paths]" >> .hg/hgrc
90 $ echo "default = ../remote1" >> .hg/hgrc
91
92 test subtracting something from an addset
93
94 $ log '(outgoing() or removes(a)) - removes(a)'
95 8
96 9
97
98 test intersecting something with an addset
99
100 $ log 'parents(outgoing() or removes(a))'
101 1
102 4
103 8
104
105 test that `or` operation combines elements in the right order:
106
107 $ log '3:4 or 2:5'
108 3
109 4
110 2
111 5
112 $ log '3:4 or 5:2'
113 3
114 4
115 5
116 2
117 $ log 'sort(3:4 or 2:5)'
118 2
119 3
120 4
121 5
122 $ log 'sort(3:4 or 5:2)'
123 2
124 3
125 4
126 5
127
128 test that more than one `-r`s are combined in the right order and deduplicated:
129
130 $ hg log -T '{rev}\n' -r 3 -r 3 -r 4 -r 5:2 -r 'ancestors(4)'
131 3
132 4
133 5
134 2
135 0
136 1
137
138 test that `or` operation skips duplicated revisions from right-hand side
139
140 $ try 'reverse(1::5) or ancestors(4)'
141 (or
142 (list
143 (func
144 (symbol 'reverse')
145 (dagrange
146 (symbol '1')
147 (symbol '5')))
148 (func
149 (symbol 'ancestors')
150 (symbol '4'))))
151 * set:
152 <addset
153 <baseset- [1, 3, 5]>,
154 <generatorsetdesc+>>
155 5
156 3
157 1
158 0
159 2
160 4
161 $ try 'sort(ancestors(4) or reverse(1::5))'
162 (func
163 (symbol 'sort')
164 (or
165 (list
166 (func
167 (symbol 'ancestors')
168 (symbol '4'))
169 (func
170 (symbol 'reverse')
171 (dagrange
172 (symbol '1')
173 (symbol '5'))))))
174 * set:
175 <addset+
176 <generatorsetdesc+>,
177 <baseset- [1, 3, 5]>>
178 0
179 1
180 2
181 3
182 4
183 5
184
185 test optimization of trivial `or` operation
186
187 $ try --optimize '0|(1)|"2"|-2|tip|null'
188 (or
189 (list
190 (symbol '0')
191 (group
192 (symbol '1'))
193 (string '2')
194 (negate
195 (symbol '2'))
196 (symbol 'tip')
197 (symbol 'null')))
198 * optimized:
199 (func
200 (symbol '_list')
201 (string '0\x001\x002\x00-2\x00tip\x00null'))
202 * set:
203 <baseset [0, 1, 2, 8, 9, -1]>
204 0
205 1
206 2
207 8
208 9
209 -1
210
211 $ try --optimize '0|1|2:3'
212 (or
213 (list
214 (symbol '0')
215 (symbol '1')
216 (range
217 (symbol '2')
218 (symbol '3'))))
219 * optimized:
220 (or
221 (list
222 (func
223 (symbol '_list')
224 (string '0\x001'))
225 (range
226 (symbol '2')
227 (symbol '3'))))
228 * set:
229 <addset
230 <baseset [0, 1]>,
231 <spanset+ 2:4>>
232 0
233 1
234 2
235 3
236
237 $ try --optimize '0:1|2|3:4|5|6'
238 (or
239 (list
240 (range
241 (symbol '0')
242 (symbol '1'))
243 (symbol '2')
244 (range
245 (symbol '3')
246 (symbol '4'))
247 (symbol '5')
248 (symbol '6')))
249 * optimized:
250 (or
251 (list
252 (range
253 (symbol '0')
254 (symbol '1'))
255 (symbol '2')
256 (range
257 (symbol '3')
258 (symbol '4'))
259 (func
260 (symbol '_list')
261 (string '5\x006'))))
262 * set:
263 <addset
264 <addset
265 <spanset+ 0:2>,
266 <baseset [2]>>,
267 <addset
268 <spanset+ 3:5>,
269 <baseset [5, 6]>>>
270 0
271 1
272 2
273 3
274 4
275 5
276 6
277
278 unoptimized `or` looks like this
279
280 $ try --no-optimized -p analyzed '0|1|2|3|4'
281 * analyzed:
282 (or
283 (list
284 (symbol '0')
285 (symbol '1')
286 (symbol '2')
287 (symbol '3')
288 (symbol '4')))
289 * set:
290 <addset
291 <addset
292 <baseset [0]>,
293 <baseset [1]>>,
294 <addset
295 <baseset [2]>,
296 <addset
297 <baseset [3]>,
298 <baseset [4]>>>>
299 0
300 1
301 2
302 3
303 4
304
305 test that `_list` should be narrowed by provided `subset`
306
307 $ log '0:2 and (null|1|2|3)'
308 1
309 2
310
311 test that `_list` should remove duplicates
312
313 $ log '0|1|2|1|2|-1|tip'
314 0
315 1
316 2
317 9
318
319 test unknown revision in `_list`
320
321 $ log '0|unknown'
322 abort: unknown revision 'unknown'
323 [10]
324
325 test integer range in `_list`
326
327 $ log '-1|-10'
328 9
329 0
330
331 $ log '-10|-11'
332 abort: unknown revision '-11'
333 [10]
334
335 $ log '9|10'
336 abort: unknown revision '10'
337 [10]
338
339 test '0000' != '0' in `_list`
340
341 $ log '0|0000'
342 0
343 -1
344
345 test ',' in `_list`
346 $ log '0,1'
347 hg: parse error: can't use a list in this context
348 (see 'hg help "revsets.x or y"')
349 [10]
350 $ try '0,1,2'
351 (list
352 (symbol '0')
353 (symbol '1')
354 (symbol '2'))
355 hg: parse error: can't use a list in this context
356 (see 'hg help "revsets.x or y"')
357 [10]
358
359 test that chained `or` operations make balanced addsets
360
361 $ try '0:1|1:2|2:3|3:4|4:5'
362 (or
363 (list
364 (range
365 (symbol '0')
366 (symbol '1'))
367 (range
368 (symbol '1')
369 (symbol '2'))
370 (range
371 (symbol '2')
372 (symbol '3'))
373 (range
374 (symbol '3')
375 (symbol '4'))
376 (range
377 (symbol '4')
378 (symbol '5'))))
379 * set:
380 <addset
381 <addset
382 <spanset+ 0:2>,
383 <spanset+ 1:3>>,
384 <addset
385 <spanset+ 2:4>,
386 <addset
387 <spanset+ 3:5>,
388 <spanset+ 4:6>>>>
389 0
390 1
391 2
392 3
393 4
394 5
395
396 no crash by empty group "()" while optimizing `or` operations
397
398 $ try --optimize '0|()'
399 (or
400 (list
401 (symbol '0')
402 (group
403 None)))
404 * optimized:
405 (or
406 (list
407 (symbol '0')
408 None))
409 hg: parse error: missing argument
410 [10]
411
412 test that chained `or` operations never eat up stack (issue4624)
413 (uses `0:1` instead of `0` to avoid future optimization of trivial revisions)
414
415 $ hg log -T '{rev}\n' -r `"$PYTHON" -c "print('+'.join(['0:1'] * 500))"`
416 0
417 1
418
419 test that repeated `-r` options never eat up stack (issue4565)
420 (uses `-r 0::1` to avoid possible optimization at old-style parser)
421
422 $ hg log -T '{rev}\n' `"$PYTHON" -c "for i in range(500): print('-r 0::1 ')"`
423 0
424 1
425
426 check that conversion to only works
427 $ try --optimize '::3 - ::1'
428 (minus
429 (dagrangepre
430 (symbol '3'))
431 (dagrangepre
432 (symbol '1')))
433 * optimized:
434 (func
435 (symbol 'only')
436 (list
437 (symbol '3')
438 (symbol '1')))
439 * set:
440 <baseset+ [3]>
441 3
442 $ try --optimize 'ancestors(1) - ancestors(3)'
443 (minus
444 (func
445 (symbol 'ancestors')
446 (symbol '1'))
447 (func
448 (symbol 'ancestors')
449 (symbol '3')))
450 * optimized:
451 (func
452 (symbol 'only')
453 (list
454 (symbol '1')
455 (symbol '3')))
456 * set:
457 <baseset+ []>
458 $ try --optimize 'not ::2 and ::6'
459 (and
460 (not
461 (dagrangepre
462 (symbol '2')))
463 (dagrangepre
464 (symbol '6')))
465 * optimized:
466 (func
467 (symbol 'only')
468 (list
469 (symbol '6')
470 (symbol '2')))
471 * set:
472 <baseset+ [3, 4, 5, 6]>
473 3
474 4
475 5
476 6
477 $ try --optimize 'ancestors(6) and not ancestors(4)'
478 (and
479 (func
480 (symbol 'ancestors')
481 (symbol '6'))
482 (not
483 (func
484 (symbol 'ancestors')
485 (symbol '4'))))
486 * optimized:
487 (func
488 (symbol 'only')
489 (list
490 (symbol '6')
491 (symbol '4')))
492 * set:
493 <baseset+ [3, 5, 6]>
494 3
495 5
496 6
497
498 no crash by empty group "()" while optimizing to "only()"
499
500 $ try --optimize '::1 and ()'
501 (and
502 (dagrangepre
503 (symbol '1'))
504 (group
505 None))
506 * optimized:
507 (andsmally
508 (func
509 (symbol 'ancestors')
510 (symbol '1'))
511 None)
512 hg: parse error: missing argument
513 [10]
514
515 optimization to only() works only if ancestors() takes only one argument
516
517 $ hg debugrevspec -p optimized 'ancestors(6) - ancestors(4, 1)'
518 * optimized:
519 (difference
520 (func
521 (symbol 'ancestors')
522 (symbol '6'))
523 (func
524 (symbol 'ancestors')
525 (list
526 (symbol '4')
527 (symbol '1'))))
528 0
529 1
530 3
531 5
532 6
533 $ hg debugrevspec -p optimized 'ancestors(6, 1) - ancestors(4)'
534 * optimized:
535 (difference
536 (func
537 (symbol 'ancestors')
538 (list
539 (symbol '6')
540 (symbol '1')))
541 (func
542 (symbol 'ancestors')
543 (symbol '4')))
544 5
545 6
546
547 optimization disabled if keyword arguments passed (because we're too lazy
548 to support it)
549
550 $ hg debugrevspec -p optimized 'ancestors(set=6) - ancestors(set=4)'
551 * optimized:
552 (difference
553 (func
554 (symbol 'ancestors')
555 (keyvalue
556 (symbol 'set')
557 (symbol '6')))
558 (func
559 (symbol 'ancestors')
560 (keyvalue
561 (symbol 'set')
562 (symbol '4'))))
563 3
564 5
565 6
566
567 invalid function call should not be optimized to only()
568
569 $ log '"ancestors"(6) and not ancestors(4)'
570 hg: parse error: not a symbol
571 [10]
572
573 $ log 'ancestors(6) and not "ancestors"(4)'
574 hg: parse error: not a symbol
575 [10]
576
577 test empty string
578
579 $ log ''
580 hg: parse error: empty query
581 [10]
582 $ log 'parents("")'
583 hg: parse error: empty string is not a valid revision
584 [10]
585
586 test empty revset
587 $ hg log 'none()'
588
589 we can use patterns when searching for tags
590
591 $ log 'tag("1..*")'
592 abort: tag '1..*' does not exist
593 [10]
594 $ log 'tag("re:1..*")'
595 6
596 $ log 'tag("re:[0-9].[0-9]")'
597 6
598 $ log 'tag("literal:1.0")'
599 6
600 $ log 'tag("re:0..*")'
601
602 $ log 'tag(unknown)'
603 abort: tag 'unknown' does not exist
604 [10]
605 $ log 'tag("re:unknown")'
606 $ log 'present(tag("unknown"))'
607 $ log 'present(tag("re:unknown"))'
608 $ log 'branch(unknown)'
609 abort: unknown revision 'unknown'
610 [10]
611 $ log 'branch("literal:unknown")'
612 abort: branch 'unknown' does not exist
613 [10]
614 $ log 'branch("re:unknown")'
615 $ log 'present(branch("unknown"))'
616 $ log 'present(branch("re:unknown"))'
617 $ log 'user(bob)'
618 2
619
620 $ log '4::8'
621 4
622 8
623 $ log '4:8'
624 4
625 5
626 6
627 7
628 8
629
630 $ log 'sort(!merge() & (modifies(b) | user(bob) | keyword(bug) | keyword(issue) & 1::9), "-date")'
631 4
632 2
633 5
634
635 $ log 'not 0 and 0:2'
636 1
637 2
638 $ log 'not 1 and 0:2'
639 0
640 2
641 $ log 'not 2 and 0:2'
642 0
643 1
644 $ log '(1 and 2)::'
645 $ log '(1 and 2):'
646 $ log '(1 and 2):3'
647 $ log 'sort(head(), -rev)'
648 9
649 7
650 6
651 5
652 4
653 3
654 2
655 1
656 0
657 $ log '4::8 - 8'
658 4
659
660 matching() should preserve the order of the input set:
661
662 $ log '(2 or 3 or 1) and matching(1 or 2 or 3)'
663 2
664 3
665 1
666
667 $ log 'named("unknown")'
668 abort: namespace 'unknown' does not exist
669 [10]
670 $ log 'named("re:unknown")'
671 $ log 'present(named("unknown"))'
672 $ log 'present(named("re:unknown"))'
673
674 $ log 'tag()'
675 6
676 $ log 'named("tags")'
677 6
678
679 issue2437
680
681 $ log '3 and p1(5)'
682 3
683 $ log '4 and p2(6)'
684 4
685 $ log '1 and parents(:2)'
686 1
687 $ log '2 and children(1:)'
688 2
689 $ log 'roots(all()) or roots(all())'
690 0
691 $ hg debugrevspec 'roots(all()) or roots(all())'
692 0
693 $ log 'heads(branch(é)) or heads(branch(é))'
694 9
695 $ log 'ancestors(8) and (heads(branch("-a-b-c-")) or heads(branch(é)))'
696 4
697
698 issue2654: report a parse error if the revset was not completely parsed
699
700 $ log '1 OR 2'
701 hg: parse error at 2: invalid token
702 (1 OR 2
703 ^ here)
704 [10]
705
706 or operator should preserve ordering:
707 $ log 'reverse(2::4) or tip'
708 4
709 2
710 9
711
712 parentrevspec
713
714 $ log 'merge()^0'
715 6
716 $ log 'merge()^'
717 5
718 $ log 'merge()^1'
719 5
720 $ log 'merge()^2'
721 4
722 $ log '(not merge())^2'
723 $ log 'merge()^^'
724 3
725 $ log 'merge()^1^'
726 3
727 $ log 'merge()^^^'
728 1
729
730 $ hg debugrevspec -s '(merge() | 0)~-1'
731 * set:
732 <baseset+ [1, 7]>
733 1
734 7
735 $ log 'merge()~-1'
736 7
737 $ log 'tip~-1'
738 $ log '(tip | merge())~-1'
739 7
740 $ log 'merge()~0'
741 6
742 $ log 'merge()~1'
743 5
744 $ log 'merge()~2'
745 3
746 $ log 'merge()~2^1'
747 1
748 $ log 'merge()~3'
749 1
750
751 $ log '(-3:tip)^'
752 4
753 6
754 8
755
756 $ log 'tip^foo'
757 hg: parse error: ^ expects a number 0, 1, or 2
758 [10]
759
760 $ log 'branchpoint()~-1'
761 abort: revision in set has more than one child
762 [10]
763
764 Bogus function gets suggestions
765 $ log 'add()'
766 hg: parse error: unknown identifier: add
767 (did you mean adds?)
768 [10]
769 $ log 'added()'
770 hg: parse error: unknown identifier: added
771 (did you mean adds?)
772 [10]
773 $ log 'remo()'
774 hg: parse error: unknown identifier: remo
775 (did you mean one of remote, removes?)
776 [10]
777 $ log 'babar()'
778 hg: parse error: unknown identifier: babar
779 [10]
780
781 Bogus function with a similar internal name doesn't suggest the internal name
782 $ log 'matches()'
783 hg: parse error: unknown identifier: matches
784 (did you mean matching?)
785 [10]
786
787 Undocumented functions aren't suggested as similar either
788 $ log 'tagged2()'
789 hg: parse error: unknown identifier: tagged2
790 [10]
791
792 multiple revspecs
793
794 $ hg log -r 'tip~1:tip' -r 'tip~2:tip~1' --template '{rev}\n'
795 8
796 9
797 4
798 5
799 6
800 7
801
802 test usage in revpair (with "+")
803
804 (real pair)
805
806 $ hg diff -r 'tip^^' -r 'tip'
807 diff -r 2326846efdab -r d2e607fcf9e4 .hgtags
808 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
809 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
810 @@ -0,0 +1,1 @@
811 +d5e6808a86077d6f5c1ff626d4352d01da7d2a1f 1.0
812 $ hg diff -r 'tip^^::tip'
813 diff -r 2326846efdab -r d2e607fcf9e4 .hgtags
814 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
815 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
816 @@ -0,0 +1,1 @@
817 +d5e6808a86077d6f5c1ff626d4352d01da7d2a1f 1.0
818
819 (single rev)
820
821 $ hg diff -r 'tip^' -r 'tip^'
822 $ hg diff -r 'tip^:tip^'
823
824 (single rev that does not looks like a range)
825
826 $ hg diff -r 'tip^::tip^ or tip^'
827 diff -r d5d0dcbdc4d9 .hgtags
828 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
829 +++ b/.hgtags * (glob)
830 @@ -0,0 +1,1 @@
831 +d5e6808a86077d6f5c1ff626d4352d01da7d2a1f 1.0
832 $ hg diff -r 'tip^ or tip^'
833 diff -r d5d0dcbdc4d9 .hgtags
834 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
835 +++ b/.hgtags * (glob)
836 @@ -0,0 +1,1 @@
837 +d5e6808a86077d6f5c1ff626d4352d01da7d2a1f 1.0
838
839 (no rev)
840
841 $ hg diff -r 'author("babar") or author("celeste")'
842 abort: empty revision range
843 [10]
844
845 aliases:
846
847 $ echo '[revsetalias]' >> .hg/hgrc
848 $ echo 'm = merge()' >> .hg/hgrc
849 (revset aliases can override builtin revsets)
850 $ echo 'p2($1) = p1($1)' >> .hg/hgrc
851 $ echo 'sincem = descendants(m)' >> .hg/hgrc
852 $ echo 'd($1) = reverse(sort($1, date))' >> .hg/hgrc
853 $ echo 'rs(ARG1, ARG2) = reverse(sort(ARG1, ARG2))' >> .hg/hgrc
854 $ echo 'rs4(ARG1, ARGA, ARGB, ARG2) = reverse(sort(ARG1, ARG2))' >> .hg/hgrc
855
856 $ try m
857 (symbol 'm')
858 * expanded:
859 (func
860 (symbol 'merge')
861 None)
862 * set:
863 <filteredset
864 <fullreposet+ 0:10>,
865 <merge>>
866 6
867
868 $ HGPLAIN=1
869 $ export HGPLAIN
870 $ try m
871 (symbol 'm')
872 abort: unknown revision 'm'
873 [10]
874
875 $ HGPLAINEXCEPT=revsetalias
876 $ export HGPLAINEXCEPT
877 $ try m
878 (symbol 'm')
879 * expanded:
880 (func
881 (symbol 'merge')
882 None)
883 * set:
884 <filteredset
885 <fullreposet+ 0:10>,
886 <merge>>
887 6
888
889 $ unset HGPLAIN
890 $ unset HGPLAINEXCEPT
891
892 $ try 'p2(.)'
893 (func
894 (symbol 'p2')
895 (symbol '.'))
896 * expanded:
897 (func
898 (symbol 'p1')
899 (symbol '.'))
900 * set:
901 <baseset+ [8]>
902 8
903
904 $ HGPLAIN=1
905 $ export HGPLAIN
906 $ try 'p2(.)'
907 (func
908 (symbol 'p2')
909 (symbol '.'))
910 * set:
911 <baseset+ []>
912
913 $ HGPLAINEXCEPT=revsetalias
914 $ export HGPLAINEXCEPT
915 $ try 'p2(.)'
916 (func
917 (symbol 'p2')
918 (symbol '.'))
919 * expanded:
920 (func
921 (symbol 'p1')
922 (symbol '.'))
923 * set:
924 <baseset+ [8]>
925 8
926
927 $ unset HGPLAIN
928 $ unset HGPLAINEXCEPT
929
930 test alias recursion
931
932 $ try sincem
933 (symbol 'sincem')
934 * expanded:
935 (func
936 (symbol 'descendants')
937 (func
938 (symbol 'merge')
939 None))
940 * set:
941 <generatorsetasc+>
942 6
943 7
944
945 test infinite recursion
946
947 $ echo 'recurse1 = recurse2' >> .hg/hgrc
948 $ echo 'recurse2 = recurse1' >> .hg/hgrc
949 $ try recurse1
950 (symbol 'recurse1')
951 hg: parse error: infinite expansion of revset alias "recurse1" detected
952 [10]
953
954 $ echo 'level1($1, $2) = $1 or $2' >> .hg/hgrc
955 $ echo 'level2($1, $2) = level1($2, $1)' >> .hg/hgrc
956 $ try "level2(level1(1, 2), 3)"
957 (func
958 (symbol 'level2')
959 (list
960 (func
961 (symbol 'level1')
962 (list
963 (symbol '1')
964 (symbol '2')))
965 (symbol '3')))
966 * expanded:
967 (or
968 (list
969 (symbol '3')
970 (or
971 (list
972 (symbol '1')
973 (symbol '2')))))
974 * set:
975 <addset
976 <baseset [3]>,
977 <baseset [1, 2]>>
978 3
979 1
980 2
981
982 test nesting and variable passing
983
984 $ echo 'nested($1) = nested2($1)' >> .hg/hgrc
985 $ echo 'nested2($1) = nested3($1)' >> .hg/hgrc
986 $ echo 'nested3($1) = max($1)' >> .hg/hgrc
987 $ try 'nested(2:5)'
988 (func
989 (symbol 'nested')
990 (range
991 (symbol '2')
992 (symbol '5')))
993 * expanded:
994 (func
995 (symbol 'max')
996 (range
997 (symbol '2')
998 (symbol '5')))
999 * set:
1000 <baseset
1001 <max
1002 <fullreposet+ 0:10>,
1003 <spanset+ 2:6>>>
1004 5
1005
1006 test chained `or` operations are flattened at parsing phase
1007
1008 $ echo 'chainedorops($1, $2, $3) = $1|$2|$3' >> .hg/hgrc
1009 $ try 'chainedorops(0:1, 1:2, 2:3)'
1010 (func
1011 (symbol 'chainedorops')
1012 (list
1013 (range
1014 (symbol '0')
1015 (symbol '1'))
1016 (range
1017 (symbol '1')
1018 (symbol '2'))
1019 (range
1020 (symbol '2')
1021 (symbol '3'))))
1022 * expanded:
1023 (or
1024 (list
1025 (range
1026 (symbol '0')
1027 (symbol '1'))
1028 (range
1029 (symbol '1')
1030 (symbol '2'))
1031 (range
1032 (symbol '2')
1033 (symbol '3'))))
1034 * set:
1035 <addset
1036 <spanset+ 0:2>,
1037 <addset
1038 <spanset+ 1:3>,
1039 <spanset+ 2:4>>>
1040 0
1041 1
1042 2
1043 3
1044
1045 test variable isolation, variable placeholders are rewritten as string
1046 then parsed and matched again as string. Check they do not leak too
1047 far away.
1048
1049 $ echo 'injectparamasstring = max("$1")' >> .hg/hgrc
1050 $ echo 'callinjection($1) = descendants(injectparamasstring)' >> .hg/hgrc
1051 $ try 'callinjection(2:5)'
1052 (func
1053 (symbol 'callinjection')
1054 (range
1055 (symbol '2')
1056 (symbol '5')))
1057 * expanded:
1058 (func
1059 (symbol 'descendants')
1060 (func
1061 (symbol 'max')
1062 (string '$1')))
1063 abort: unknown revision '$1'
1064 [10]
1065
1066 test scope of alias expansion: 'universe' is expanded prior to 'shadowall(0)',
1067 but 'all()' should never be substituted to '0()'.
1068
1069 $ echo 'universe = all()' >> .hg/hgrc
1070 $ echo 'shadowall(all) = all and universe' >> .hg/hgrc
1071 $ try 'shadowall(0)'
1072 (func
1073 (symbol 'shadowall')
1074 (symbol '0'))
1075 * expanded:
1076 (and
1077 (symbol '0')
1078 (func
1079 (symbol 'all')
1080 None))
1081 * set:
1082 <filteredset
1083 <baseset [0]>,
1084 <spanset+ 0:10>>
1085 0
1086
1087 test unknown reference:
1088
1089 $ try "unknownref(0)" --config 'revsetalias.unknownref($1)=$1:$2'
1090 (func
1091 (symbol 'unknownref')
1092 (symbol '0'))
1093 abort: bad definition of revset alias "unknownref": invalid symbol '$2'
1094 [255]
1095
1096 $ hg debugrevspec --debug --config revsetalias.anotherbadone='branch(' "tip"
1097 (symbol 'tip')
1098 warning: bad definition of revset alias "anotherbadone": at 7: not a prefix: end
1099 * set:
1100 <baseset [9]>
1101 9
1102
1103 $ try 'tip'
1104 (symbol 'tip')
1105 * set:
1106 <baseset [9]>
1107 9
1108
1109 $ hg debugrevspec --debug --config revsetalias.'bad name'='tip' "tip"
1110 (symbol 'tip')
1111 warning: bad declaration of revset alias "bad name": at 4: invalid token
1112 * set:
1113 <baseset [9]>
1114 9
1115 $ echo 'strictreplacing($1, $10) = $10 or desc("$1")' >> .hg/hgrc
1116 $ try 'strictreplacing("foo", tip)'
1117 (func
1118 (symbol 'strictreplacing')
1119 (list
1120 (string 'foo')
1121 (symbol 'tip')))
1122 * expanded:
1123 (or
1124 (list
1125 (symbol 'tip')
1126 (func
1127 (symbol 'desc')
1128 (string '$1'))))
1129 * set:
1130 <addset
1131 <baseset [9]>,
1132 <filteredset
1133 <fullreposet+ 0:10>,
1134 <desc '$1'>>>
1135 9
1136
1137 $ try 'd(2:5)'
1138 (func
1139 (symbol 'd')
1140 (range
1141 (symbol '2')
1142 (symbol '5')))
1143 * expanded:
1144 (func
1145 (symbol 'reverse')
1146 (func
1147 (symbol 'sort')
1148 (list
1149 (range
1150 (symbol '2')
1151 (symbol '5'))
1152 (symbol 'date'))))
1153 * set:
1154 <baseset [4, 5, 3, 2]>
1155 4
1156 5
1157 3
1158 2
1159 $ try 'rs(2 or 3, date)'
1160 (func
1161 (symbol 'rs')
1162 (list
1163 (or
1164 (list
1165 (symbol '2')
1166 (symbol '3')))
1167 (symbol 'date')))
1168 * expanded:
1169 (func
1170 (symbol 'reverse')
1171 (func
1172 (symbol 'sort')
1173 (list
1174 (or
1175 (list
1176 (symbol '2')
1177 (symbol '3')))
1178 (symbol 'date'))))
1179 * set:
1180 <baseset [3, 2]>
1181 3
1182 2
1183 $ try 'rs()'
1184 (func
1185 (symbol 'rs')
1186 None)
1187 hg: parse error: invalid number of arguments: 0
1188 [10]
1189 $ try 'rs(2)'
1190 (func
1191 (symbol 'rs')
1192 (symbol '2'))
1193 hg: parse error: invalid number of arguments: 1
1194 [10]
1195 $ try 'rs(2, data, 7)'
1196 (func
1197 (symbol 'rs')
1198 (list
1199 (symbol '2')
1200 (symbol 'data')
1201 (symbol '7')))
1202 hg: parse error: invalid number of arguments: 3
1203 [10]
1204 $ try 'rs4(2 or 3, x, x, date)'
1205 (func
1206 (symbol 'rs4')
1207 (list
1208 (or
1209 (list
1210 (symbol '2')
1211 (symbol '3')))
1212 (symbol 'x')
1213 (symbol 'x')
1214 (symbol 'date')))
1215 * expanded:
1216 (func
1217 (symbol 'reverse')
1218 (func
1219 (symbol 'sort')
1220 (list
1221 (or
1222 (list
1223 (symbol '2')
1224 (symbol '3')))
1225 (symbol 'date'))))
1226 * set:
1227 <baseset [3, 2]>
1228 3
1229 2
1230
1231 issue4553: check that revset aliases override existing hash prefix
1232
1233 $ hg log -qr d5e
1234 6:d5e6808a8607
1235
1236 $ hg log -qr d5e --config revsetalias.d5e="all()"
1237 0:2785f51eece5
1238 1:d75937da8da0
1239 2:5ed5505e9f1c
1240 3:8528aa5637f2
1241 4:2326846efdab
1242 5:904fa392b941
1243 6:d5e6808a8607
1244 7:586353d483b3
1245 8:d5d0dcbdc4d9
1246 9:d2e607fcf9e4
1247
1248 $ hg log -qr d5e: --config revsetalias.d5e="0"
1249 0:2785f51eece5
1250 1:d75937da8da0
1251 2:5ed5505e9f1c
1252 3:8528aa5637f2
1253 4:2326846efdab
1254 5:904fa392b941
1255 6:d5e6808a8607
1256 7:586353d483b3
1257 8:d5d0dcbdc4d9
1258 9:d2e607fcf9e4
1259
1260 $ hg log -qr :d5e --config revsetalias.d5e="9"
1261 0:2785f51eece5
1262 1:d75937da8da0
1263 2:5ed5505e9f1c
1264 3:8528aa5637f2
1265 4:2326846efdab
1266 5:904fa392b941
1267 6:d5e6808a8607
1268 7:586353d483b3
1269 8:d5d0dcbdc4d9
1270 9:d2e607fcf9e4
1271
1272 $ hg log -qr d5e:
1273 6:d5e6808a8607
1274 7:586353d483b3
1275 8:d5d0dcbdc4d9
1276 9:d2e607fcf9e4
1277
1278 $ hg log -qr :d5e
1279 0:2785f51eece5
1280 1:d75937da8da0
1281 2:5ed5505e9f1c
1282 3:8528aa5637f2
1283 4:2326846efdab
1284 5:904fa392b941
1285 6:d5e6808a8607
1286
1287 issue2549 - correct optimizations
1288
1289 $ try 'limit(1 or 2 or 3, 2) and not 2'
1290 (and
1291 (func
1292 (symbol 'limit')
1293 (list
1294 (or
1295 (list
1296 (symbol '1')
1297 (symbol '2')
1298 (symbol '3')))
1299 (symbol '2')))
1300 (not
1301 (symbol '2')))
1302 * set:
1303 <filteredset
1304 <baseset [1, 2]>,
1305 <not
1306 <baseset [2]>>>
1307 1
1308 $ try 'max(1 or 2) and not 2'
1309 (and
1310 (func
1311 (symbol 'max')
1312 (or
1313 (list
1314 (symbol '1')
1315 (symbol '2'))))
1316 (not
1317 (symbol '2')))
1318 * set:
1319 <filteredset
1320 <baseset
1321 <max
1322 <fullreposet+ 0:10>,
1323 <baseset [1, 2]>>>,
1324 <not
1325 <baseset [2]>>>
1326 $ try 'min(1 or 2) and not 1'
1327 (and
1328 (func
1329 (symbol 'min')
1330 (or
1331 (list
1332 (symbol '1')
1333 (symbol '2'))))
1334 (not
1335 (symbol '1')))
1336 * set:
1337 <filteredset
1338 <baseset
1339 <min
1340 <fullreposet+ 0:10>,
1341 <baseset [1, 2]>>>,
1342 <not
1343 <baseset [1]>>>
1344 $ try 'last(1 or 2, 1) and not 2'
1345 (and
1346 (func
1347 (symbol 'last')
1348 (list
1349 (or
1350 (list
1351 (symbol '1')
1352 (symbol '2')))
1353 (symbol '1')))
1354 (not
1355 (symbol '2')))
1356 * set:
1357 <filteredset
1358 <baseset [2]>,
1359 <not
1360 <baseset [2]>>>
1361
1362 issue4289 - ordering of built-ins
1363 $ hg log -M -q -r 3:2
1364 3:8528aa5637f2
1365 2:5ed5505e9f1c
1366
1367 test revsets started with 40-chars hash (issue3669)
1368
1369 $ ISSUE3669_TIP=`hg tip --template '{node}'`
1370 $ hg log -r "${ISSUE3669_TIP}" --template '{rev}\n'
1371 9
1372 $ hg log -r "${ISSUE3669_TIP}^" --template '{rev}\n'
1373 8
1374
1375 test or-ed indirect predicates (issue3775)
1376
1377 $ log '6 or 6^1' | sort
1378 5
1379 6
1380 $ log '6^1 or 6' | sort
1381 5
1382 6
1383 $ log '4 or 4~1' | sort
1384 2
1385 4
1386 $ log '4~1 or 4' | sort
1387 2
1388 4
1389 $ log '(0 or 2):(4 or 6) or 0 or 6' | sort
1390 0
1391 1
1392 2
1393 3
1394 4
1395 5
1396 6
1397 $ log '0 or 6 or (0 or 2):(4 or 6)' | sort
1398 0
1399 1
1400 2
1401 3
1402 4
1403 5
1404 6
1405
1406 tests for 'remote()' predicate:
1407 #. (csets in remote) (id) (remote)
1408 1. less than local current branch "default"
1409 2. same with local specified "default"
1410 3. more than local specified specified
1411
1412 $ hg clone --quiet -U . ../remote3
1413 $ cd ../remote3
1414 $ hg update -q 7
1415 $ echo r > r
1416 $ hg ci -Aqm 10
1417 $ log 'remote()'
1418 7
1419 $ log 'remote("a-b-c-")'
1420 2
1421 $ cd ../repo
1422 $ log 'remote(".a.b.c.", "../remote3")'
1423
1424 tests for concatenation of strings/symbols by "##"
1425
1426 $ try "278 ## '5f5' ## 1ee ## 'ce5'"
1427 (_concat
1428 (_concat
1429 (_concat
1430 (symbol '278')
1431 (string '5f5'))
1432 (symbol '1ee'))
1433 (string 'ce5'))
1434 * concatenated:
1435 (string '2785f51eece5')
1436 * set:
1437 <baseset [0]>
1438 0
1439
1440 $ echo 'cat4($1, $2, $3, $4) = $1 ## $2 ## $3 ## $4' >> .hg/hgrc
1441 $ try "cat4(278, '5f5', 1ee, 'ce5')"
1442 (func
1443 (symbol 'cat4')
1444 (list
1445 (symbol '278')
1446 (string '5f5')
1447 (symbol '1ee')
1448 (string 'ce5')))
1449 * expanded:
1450 (_concat
1451 (_concat
1452 (_concat
1453 (symbol '278')
1454 (string '5f5'))
1455 (symbol '1ee'))
1456 (string 'ce5'))
1457 * concatenated:
1458 (string '2785f51eece5')
1459 * set:
1460 <baseset [0]>
1461 0
1462
1463 (check concatenation in alias nesting)
1464
1465 $ echo 'cat2($1, $2) = $1 ## $2' >> .hg/hgrc
1466 $ echo 'cat2x2($1, $2, $3, $4) = cat2($1 ## $2, $3 ## $4)' >> .hg/hgrc
1467 $ log "cat2x2(278, '5f5', 1ee, 'ce5')"
1468 0
1469
1470 (check operator priority)
1471
1472 $ echo 'cat2n2($1, $2, $3, $4) = $1 ## $2 or $3 ## $4~2' >> .hg/hgrc
1473 $ log "cat2n2(2785f5, 1eece5, d2e607, fcf9e4)"
1474 0
1475 4
1476
1477 $ cd ..
1478
1479 prepare repository that has "default" branches of multiple roots
1480
1481 $ hg init namedbranch
1482 $ cd namedbranch
1483
1484 $ log 'roots(.)'
1485 -1
1486 $ log 'roots(. or wdir())'
1487 -1
1488 $ log 'roots(wdir())'
1489 2147483647
1490 $ log 'sort(., -topo)'
1491 -1
1492 $ log 'sort(. or wdir(), -topo)'
1493 -1
1494 2147483647
1495 $ log 'sort(wdir(), -topo)'
1496 2147483647
1497
1498 $ echo default0 >> a
1499 $ hg ci -Aqm0
1500 $ echo default1 >> a
1501 $ hg ci -m1
1502
1503 $ hg branch -q stable
1504 $ echo stable2 >> a
1505 $ hg ci -m2
1506 $ echo stable3 >> a
1507 $ hg ci -m3
1508
1509 $ hg update -q null
1510 $ echo default4 >> a
1511 $ hg ci -Aqm4
1512 $ echo default5 >> a
1513 $ hg ci -m5
1514
1515 $ log 'roots(. or wdir())'
1516 5
1517 $ log 'roots(wdir())'
1518 2147483647
1519 $ log 'sort(. or wdir() or .^, -topo)'
1520 4
1521 5
1522 2147483647
1523 $ log 'sort(wdir(), -topo)'
1524 2147483647
1525
1526 "null" revision belongs to "default" branch (issue4683)
1527
1528 $ log 'branch(null)'
1529 0
1530 1
1531 4
1532 5
1533
1534 "null" revision belongs to "default" branch, but it shouldn't appear in set
1535 unless explicitly specified (issue4682)
1536
1537 $ log 'children(branch(default))'
1538 1
1539 2
1540 5
1541
1542 $ cd ..
1543
1544 test author/desc/keyword in problematic encoding
1545 # unicode: cp932:
1546 # u30A2 0x83 0x41(= 'A')
1547 # u30C2 0x83 0x61(= 'a')
1548
1549 $ hg init problematicencoding
1550 $ cd problematicencoding
1551
1552 $ "$PYTHON" <<EOF
1553 > open('setup.sh', 'wb').write(u'''
1554 > echo a > text
1555 > hg add text
1556 > hg --encoding utf-8 commit -u '\u30A2' -m none
1557 > echo b > text
1558 > hg --encoding utf-8 commit -u '\u30C2' -m none
1559 > echo c > text
1560 > hg --encoding utf-8 commit -u none -m '\u30A2'
1561 > echo d > text
1562 > hg --encoding utf-8 commit -u none -m '\u30C2'
1563 > '''.encode('utf-8'))
1564 > EOF
1565 $ sh < setup.sh
1566
1567 test in problematic encoding
1568 $ "$PYTHON" <<EOF
1569 > open('test.sh', 'wb').write(u'''
1570 > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30A2)'
1571 > echo ====
1572 > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30C2)'
1573 > echo ====
1574 > hg --encoding cp932 log --template '{rev}\\n' -r 'desc(\u30A2)'
1575 > echo ====
1576 > hg --encoding cp932 log --template '{rev}\\n' -r 'desc(\u30C2)'
1577 > echo ====
1578 > hg --encoding cp932 log --template '{rev}\\n' -r 'keyword(\u30A2)'
1579 > echo ====
1580 > hg --encoding cp932 log --template '{rev}\\n' -r 'keyword(\u30C2)'
1581 > '''.encode('cp932'))
1582 > EOF
1583 $ sh < test.sh
1584 0
1585 ====
1586 1
1587 ====
1588 2
1589 ====
1590 3
1591 ====
1592 0
1593 2
1594 ====
1595 1
1596 3
1597
1598 test error message of bad revset
1599 $ hg log -r 'foo\\'
1600 hg: parse error at 3: syntax error in revset 'foo\\'
1601 (foo\\
1602 ^ here)
1603 [10]
1604
1605 $ cd ..
1606
1607 Test that revset predicate of extension isn't loaded at failure of
1608 loading it
1609
1610 $ cd repo
1611
1612 $ cat <<EOF > $TESTTMP/custompredicate.py
1613 > from mercurial import error, registrar, revset
1614 >
1615 > revsetpredicate = registrar.revsetpredicate()
1616 >
1617 > @revsetpredicate(b'custom1()')
1618 > def custom1(repo, subset, x):
1619 > return revset.baseset([1])
1620 >
1621 > raise error.Abort(b'intentional failure of loading extension')
1622 > EOF
1623 $ cat <<EOF > .hg/hgrc
1624 > [extensions]
1625 > custompredicate = $TESTTMP/custompredicate.py
1626 > EOF
1627
1628 $ hg debugrevspec "custom1()"
1629 *** failed to import extension "custompredicate" from $TESTTMP/custompredicate.py: intentional failure of loading extension
1630 hg: parse error: unknown identifier: custom1
1631 [10]
1632
1633 Test repo.anyrevs with customized revset overrides
1634
1635 $ cat > $TESTTMP/printprevset.py <<EOF
1636 > from mercurial import encoding, registrar
1637 > cmdtable = {}
1638 > command = registrar.command(cmdtable)
1639 > @command(b'printprevset')
1640 > def printprevset(ui, repo):
1641 > alias = {}
1642 > p = encoding.environ.get(b'P')
1643 > if p:
1644 > alias[b'P'] = p
1645 > revs = repo.anyrevs([b'P'], user=True, localalias=alias)
1646 > ui.write(b'P=%r\n' % list(revs))
1647 > EOF
1648
1649 $ cat >> .hg/hgrc <<EOF
1650 > custompredicate = !
1651 > printprevset = $TESTTMP/printprevset.py
1652 > EOF
1653
1654 $ unset P
1655 $ hg --config revsetalias.P=1 printprevset
1656 P=[1]
1657 $ P=3 hg --config revsetalias.P=2 printprevset
1658 P=[3]
1659
1660 $ cd ..
1661
1662 Test obsstore related revsets
1663
1664 $ hg init repo1
1665 $ cd repo1
1666 $ cat <<EOF >> .hg/hgrc
1667 > [experimental]
1668 > evolution.createmarkers=True
1669 > EOF
1670
1671 $ hg debugdrawdag <<'EOS'
1672 > F G
1673 > |/ # split: B -> E, F
1674 > B C D E # amend: B -> C -> D
1675 > \|/ | # amend: F -> G
1676 > A A Z # amend: A -> Z
1677 > EOS
1678 3 new orphan changesets
1679 3 new content-divergent changesets
1680
1681 $ hg log -r 'successors(Z)' -T '{desc}\n'
1682 Z
1683
1684 $ hg log -r 'successors(F)' -T '{desc}\n'
1685 F
1686 G
1687
1688 $ hg tag --remove --local C D E F G
1689
1690 $ hg log -r 'successors(B)' -T '{desc}\n'
1691 B
1692 D
1693 E
1694 G
1695
1696 $ hg log -r 'successors(B)' -T '{desc}\n' --hidden
1697 B
1698 C
1699 D
1700 E
1701 F
1702 G
1703
1704 $ hg log -r 'successors(B)-obsolete()' -T '{desc}\n' --hidden
1705 D
1706 E
1707 G
1708
1709 $ hg log -r 'successors(B+A)-contentdivergent()' -T '{desc}\n'
1710 A
1711 Z
1712 B
1713
1714 $ hg log -r 'successors(B+A)-contentdivergent()-obsolete()' -T '{desc}\n'
1715 Z
1716
1717 Test `draft() & ::x` optimization
1718
1719 $ hg init $TESTTMP/repo2
1720 $ cd $TESTTMP/repo2
1721 $ hg debugdrawdag <<'EOS'
1722 > P5 S1
1723 > | |
1724 > S2 | D3
1725 > \|/
1726 > P4
1727 > |
1728 > P3 D2
1729 > | |
1730 > P2 D1
1731 > |/
1732 > P1
1733 > |
1734 > P0
1735 > EOS
1736 $ hg phase --public -r P5
1737 $ hg phase --force --secret -r S1+S2
1738 $ hg log -G -T '{rev} {desc} {phase}' -r 'sort(all(), topo, topo.firstbranch=P5)'
1739 o 8 P5 public
1740 |
1741 | o 10 S1 secret
1742 | |
1743 | o 7 D3 draft
1744 |/
1745 | o 9 S2 secret
1746 |/
1747 o 6 P4 public
1748 |
1749 o 5 P3 public
1750 |
1751 o 3 P2 public
1752 |
1753 | o 4 D2 draft
1754 | |
1755 | o 2 D1 draft
1756 |/
1757 o 1 P1 public
1758 |
1759 o 0 P0 public
1760
1761 $ hg debugrevspec --verify -p analyzed -p optimized 'draft() & ::(((S1+D1+P5)-D3)+S2)'
1762 * analyzed:
1763 (and
1764 (func
1765 (symbol 'draft')
1766 None)
1767 (func
1768 (symbol 'ancestors')
1769 (or
1770 (list
1771 (and
1772 (or
1773 (list
1774 (symbol 'S1')
1775 (symbol 'D1')
1776 (symbol 'P5')))
1777 (not
1778 (symbol 'D3')))
1779 (symbol 'S2')))))
1780 * optimized:
1781 (func
1782 (symbol '_phaseandancestors')
1783 (list
1784 (symbol 'draft')
1785 (or
1786 (list
1787 (difference
1788 (func
1789 (symbol '_list')
1790 (string 'S1\x00D1\x00P5'))
1791 (symbol 'D3'))
1792 (symbol 'S2')))))
1793 $ hg debugrevspec --verify -p analyzed -p optimized 'secret() & ::9'
1794 * analyzed:
1795 (and
1796 (func
1797 (symbol 'secret')
1798 None)
1799 (func
1800 (symbol 'ancestors')
1801 (symbol '9')))
1802 * optimized:
1803 (func
1804 (symbol '_phaseandancestors')
1805 (list
1806 (symbol 'secret')
1807 (symbol '9')))
1808 $ hg debugrevspec --verify -p analyzed -p optimized '7 & ( (not public()) & ::(tag()) )'
1809 * analyzed:
1810 (and
1811 (symbol '7')
1812 (and
1813 (not
1814 (func
1815 (symbol 'public')
1816 None))
1817 (func
1818 (symbol 'ancestors')
1819 (func
1820 (symbol 'tag')
1821 None))))
1822 * optimized:
1823 (and
1824 (symbol '7')
1825 (func
1826 (symbol '_phaseandancestors')
1827 (list
1828 (symbol '_notpublic')
1829 (func
1830 (symbol 'tag')
1831 None))))
1832 $ hg debugrevspec --verify -p optimized '(not public()) & ancestors(S1+D2+P5, 1)'
1833 * optimized:
1834 (and
1835 (func
1836 (symbol '_notpublic')
1837 None)
1838 (func
1839 (symbol 'ancestors')
1840 (list
1841 (func
1842 (symbol '_list')
1843 (string 'S1\x00D2\x00P5'))
1844 (symbol '1'))))
1845 $ hg debugrevspec --verify -p optimized '(not public()) & ancestors(S1+D2+P5, depth=1)'
1846 * optimized:
1847 (and
1848 (func
1849 (symbol '_notpublic')
1850 None)
1851 (func
1852 (symbol 'ancestors')
1853 (list
1854 (func
1855 (symbol '_list')
1856 (string 'S1\x00D2\x00P5'))
1857 (keyvalue
1858 (symbol 'depth')
1859 (symbol '1')))))
1860
1861 test commonancestors and its optimization
1862
1863 $ hg debugrevspec --verify -p analyzed -p optimized 'heads(commonancestors(head()))'
1864 * analyzed:
1865 (func
1866 (symbol 'heads')
1867 (func
1868 (symbol 'commonancestors')
1869 (func
1870 (symbol 'head')
1871 None)))
1872 * optimized:
1873 (func
1874 (symbol '_commonancestorheads')
1875 (func
1876 (symbol 'head')
1877 None))