comparison tests/test-topic.t @ 4322:41f38bf15b4c

topic: make revsets like 'foo#stack[0]' work 'stack' relation subscript function is another way to refer to s0, s1, etc. But instead of aborting in many cases it will simply return an empty set.
author Anton Shestakov <av6@dwimlabs.net>
date Sun, 16 Dec 2018 11:22:04 +0800
parents 78700a59192a
children 482992803db6
comparison
equal deleted inserted replaced
4321:00d1963f50e5 4322:41f38bf15b4c
821 $ hg topics --age 821 $ hg topics --age
822 * fran (1970-01-01 by test, 1 changesets) 822 * fran (1970-01-01 by test, 1 changesets)
823 823
824 $ cd .. 824 $ cd ..
825 825
826 Stack relation subscript in revsets
827 ===================================
828
829 $ hg init more-than-one-commit-per-topic
830 $ cd more-than-one-commit-per-topic
831 $ cat > .hg/hgrc << EOF
832 > [phases]
833 > publish=false
834 > EOF
835
836 $ echo 0 > foo
837 $ hg ci -qAm 0
838 $ hg topic featureA
839 marked working directory as topic: featureA
840 $ echo 1 > foo
841 $ hg ci -qm 1
842 $ echo 2 > foo
843 $ hg ci -qm 2
844 $ echo 3 > foo
845 $ hg ci -qm 3
846 $ hg topic --clear
847 $ echo 4 > foo
848 $ hg ci -qm 4
849
850 $ tlog 'all()'
851 0:
852 1: featureA
853 2: featureA
854 3: featureA
855 4:
856
857 $ hg stack
858 ### target: default (branch)
859 s2@ 4 (current)
860 ^ 3
861 s1: 0
862
863 $ tlog 'tip#stack[0]'
864 $ tlog 'tip#stack[1]'
865 0:
866 $ tlog 'tip#stack[2]'
867 4:
868
869 $ hg stack featureA
870 ### topic: featureA
871 ### target: default (branch), 3 behind
872 s3: 3
873 s2: 2
874 s1: 1
875 s0^ 0 (base)
876
877 $ tlog 'featureA#s[0]'
878 0:
879 $ tlog 'featureA#s[1]'
880 1: featureA
881 $ tlog 'featureA#s[2]'
882 2: featureA
883 $ tlog 'featureA#s[3]'
884 3: featureA
885
886 $ tlog 'all()#s[-1]'
887 $ tlog 'all()#s[0]'
888 0:
889 $ tlog 'all()#s[1]'
890 0:
891 1: featureA
892 $ tlog 'all()#s[9999]'
893
894 $ hg topic featureB
895 marked working directory as topic: featureB
896 $ hg stack
897 ### topic: featureB
898 ### target: default (branch)
899 (stack is empty)
900 s0^ 4 (base current)
901 $ tlog 'wdir()#s[0]'
902 4:
903
904 $ cd ..
905
826 Testing the new config knob to forbid untopiced commit 906 Testing the new config knob to forbid untopiced commit
827 ====================================================== 907 ======================================================
828 908
829 $ hg init ponky 909 $ hg init ponky
830 $ cd ponky 910 $ cd ponky