Mercurial > hg
comparison tests/test-revset.t @ 33002:272a44cac57e
revset: add depth limit to ancestors()
This is proposed by the issue5374, and will be a building block of set{gen}
(set subscript) operator.
https://www.mercurial-scm.org/wiki/RevsetOperatorPlan#ideas_from_mpm
# reverse(ancestors(tip)) using hg repo
2) 0.075408
3) 0.075951
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 18 Jun 2017 00:22:41 +0900 |
parents | 577759ef2ed2 |
children | f63d111258da |
comparison
equal
deleted
inserted
replaced
33001:92d0945a15e0 | 33002:272a44cac57e |
---|---|
840 $ log 'ancestor(1,2,3,4,5)' | 840 $ log 'ancestor(1,2,3,4,5)' |
841 1 | 841 1 |
842 | 842 |
843 test ancestors | 843 test ancestors |
844 | 844 |
845 $ hg log -G -T '{rev}\n' --config experimental.graphshorten=True | |
846 @ 9 | |
847 o 8 | |
848 | o 7 | |
849 | o 6 | |
850 |/| | |
851 | o 5 | |
852 o | 4 | |
853 | o 3 | |
854 o | 2 | |
855 |/ | |
856 o 1 | |
857 o 0 | |
858 | |
845 $ log 'ancestors(5)' | 859 $ log 'ancestors(5)' |
846 0 | 860 0 |
847 1 | 861 1 |
848 3 | 862 3 |
849 5 | 863 5 |
852 $ log '::r3232()' | 866 $ log '::r3232()' |
853 0 | 867 0 |
854 1 | 868 1 |
855 2 | 869 2 |
856 3 | 870 3 |
871 | |
872 test ancestors with depth limit | |
873 | |
874 (depth=0 selects the node itself) | |
875 | |
876 $ log 'reverse(ancestors(9, depth=0))' | |
877 9 | |
878 | |
879 (interleaved: '4' would be missing if heap queue were higher depth first) | |
880 | |
881 $ log 'reverse(ancestors(8:9, depth=1))' | |
882 9 | |
883 8 | |
884 4 | |
885 | |
886 (interleaved: '2' would be missing if heap queue were higher depth first) | |
887 | |
888 $ log 'reverse(ancestors(7+8, depth=2))' | |
889 8 | |
890 7 | |
891 6 | |
892 5 | |
893 4 | |
894 2 | |
895 | |
896 (walk example above by separate queries) | |
897 | |
898 $ log 'reverse(ancestors(8, depth=2)) + reverse(ancestors(7, depth=2))' | |
899 8 | |
900 4 | |
901 2 | |
902 7 | |
903 6 | |
904 5 | |
905 | |
906 test bad arguments passed to ancestors() | |
907 | |
908 $ log 'ancestors(., depth=-1)' | |
909 hg: parse error: negative depth | |
910 [255] | |
911 $ log 'ancestors(., depth=foo)' | |
912 hg: parse error: ancestors expects an integer depth | |
913 [255] | |
914 | |
915 test author | |
857 | 916 |
858 $ log 'author(bob)' | 917 $ log 'author(bob)' |
859 2 | 918 2 |
860 $ log 'author("re:bob|test")' | 919 $ log 'author("re:bob|test")' |
861 0 | 920 0 |
2994 (list | 3053 (list |
2995 ('symbol', '4') | 3054 ('symbol', '4') |
2996 ('symbol', '1')) | 3055 ('symbol', '1')) |
2997 any) | 3056 any) |
2998 define) | 3057 define) |
2999 hg: parse error: ancestors takes at most 1 positional arguments | 3058 0 |
3000 [255] | 3059 1 |
3060 3 | |
3061 5 | |
3062 6 | |
3001 $ hg debugrevspec -p optimized 'ancestors(6, 1) - ancestors(4)' | 3063 $ hg debugrevspec -p optimized 'ancestors(6, 1) - ancestors(4)' |
3002 * optimized: | 3064 * optimized: |
3003 (difference | 3065 (difference |
3004 (func | 3066 (func |
3005 ('symbol', 'ancestors') | 3067 ('symbol', 'ancestors') |
3010 (func | 3072 (func |
3011 ('symbol', 'ancestors') | 3073 ('symbol', 'ancestors') |
3012 ('symbol', '4') | 3074 ('symbol', '4') |
3013 any) | 3075 any) |
3014 define) | 3076 define) |
3015 hg: parse error: ancestors takes at most 1 positional arguments | 3077 5 |
3016 [255] | 3078 6 |
3017 | 3079 |
3018 optimization disabled if keyword arguments passed (because we're too lazy | 3080 optimization disabled if keyword arguments passed (because we're too lazy |
3019 to support it) | 3081 to support it) |
3020 | 3082 |
3021 $ hg debugrevspec -p optimized 'ancestors(set=6) - ancestors(set=4)' | 3083 $ hg debugrevspec -p optimized 'ancestors(set=6) - ancestors(set=4)' |