comparison tests/test-topic-tutorial.t @ 2830:499b2dd69107 stable

doc: add part about exchanging drafts in topic tutorial
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Fri, 30 Sep 2016 18:23:04 +0200
parents 1c529afd3fef
children 08a64770ed24
comparison
equal deleted inserted replaced
2829:1c529afd3fef 2830:499b2dd69107
794 Stack is also very helpful when you have a multi-headed stack: 794 Stack is also very helpful when you have a multi-headed stack:
795 795
796 $ hg up t1 796 $ hg up t1
797 1 files updated, 0 files merged, 0 files removed, 0 files unresolved 797 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
798 798
799 $ echo nails >> shopping 799 $ echo "nails" > new_shopping
800 $ cat shopping >> new_shopping
801 $ mv new_shopping shopping
800 802
801 $ hg commit -m 'Adding nails' 803 $ hg commit -m 'Adding nails'
802 804
803 $ hg stack 805 $ hg stack
804 ### topic: tools (2 heads) 806 ### topic: tools (2 heads)
807 t3: Adding saw 809 t3: Adding saw
808 t1^ Adding hammer to the shopping list (base) 810 t1^ Adding hammer to the shopping list (base)
809 t2@ Adding nails (current) 811 t2@ Adding nails (current)
810 t1: Adding hammer to the shopping list 812 t1: Adding hammer to the shopping list
811 t0^ add a pair of shoes (base) 813 t0^ add a pair of shoes (base)
814
815 Solving this situation is easy with a topic, use merge or rebase.
816 Merge within a multi-headed stack will use the other topic head as
817 redestination if the topic has multiple heads.
818
819 $ hg log -G
820 @ changeset: 21:f936c6da9d61
821 | tag: tip
822 | topic: tools
823 | parent: 18:b7509bd417f8
824 | user: test
825 | date: Thu Jan 01 00:00:00 1970 +0000
826 | summary: Adding nails
827 |
828 | o changeset: 20:bae3758e46bf
829 | | topic: tools
830 | | user: test
831 | | date: Thu Jan 01 00:00:00 1970 +0000
832 | | summary: Adding drill
833 | |
834 | o changeset: 19:d5c51ee5762a
835 |/ topic: tools
836 | user: test
837 | date: Thu Jan 01 00:00:00 1970 +0000
838 | summary: Adding saw
839 |
840 o changeset: 18:b7509bd417f8
841 | topic: tools
842 | parent: 12:fbff9bc37a43
843 | user: test
844 | date: Thu Jan 01 00:00:00 1970 +0000
845 | summary: Adding hammer to the shopping list
846 |
847 | o changeset: 17:4cd7c1591a67
848 | | user: test
849 | | date: Thu Jan 01 00:00:00 1970 +0000
850 | | summary: Adding orange juice
851 | |
852 | o changeset: 16:20759cb47ff8
853 |/ parent: 12:fbff9bc37a43
854 | user: test
855 | date: Thu Jan 01 00:00:00 1970 +0000
856 | summary: Adding apple juice
857 |
858 o changeset: 12:fbff9bc37a43
859 | user: test
860 | date: Thu Jan 01 00:00:00 1970 +0000
861 | summary: add a pair of shoes
862 |
863 o changeset: 11:f2d6cacc6115
864 | parent: 5:2d50db8b5b4c
865 | user: test
866 | date: Thu Jan 01 00:00:00 1970 +0000
867 | summary: add a coat
868 |
869 o changeset: 5:2d50db8b5b4c
870 | user: test
871 | date: Thu Jan 01 00:00:00 1970 +0000
872 | summary: adding fruits
873 |
874 o changeset: 4:4011b46eeb33
875 | user: test
876 | date: Thu Jan 01 00:00:00 1970 +0000
877 | summary: adding condiments
878 |
879 o changeset: 3:6104862e8b84
880 | parent: 0:38da43f0a2ea
881 | user: test
882 | date: Thu Jan 01 00:00:00 1970 +0000
883 | summary: Adding clothes
884 |
885 o changeset: 0:38da43f0a2ea
886 user: test
887 date: Thu Jan 01 00:00:00 1970 +0000
888 summary: Shopping list
889
890
891 $ hg up t4
892 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
893
894 $ hg rebase
895 rebasing 19:d5c51ee5762a "Adding saw"
896 merging shopping
897 rebasing 20:bae3758e46bf "Adding drill"
898 merging shopping
899
900 $ hg commit -m "Merge tools"
901 nothing changed
902 [1]
903
904 $ hg stack
905 ### topic: tools
906 ### branch: default, 2 behind
907 t4@ Adding drill (current)
908 t3: Adding saw
909 t2: Adding nails
910 t1: Adding hammer to the shopping list
911 t0^ add a pair of shoes (base)
912
913 Collaborating through non-publishing server
914 ===========================================
915
916 .. setup:
917
918 .. Let's create a non-publishing server:
919
920 $ cd ..
921
922 $ hg clone server non-publishing-server
923 updating to branch default
924 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
925
926 $ cd non-publishing-server
927 $ cat >> .hg/hgrc << EOF
928 > [phases]
929 > publish = false
930 > EOF
931
932 .. And another client:
933
934 $ cd ..
935
936 $ hg clone server other-client
937 updating to branch default
938 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
939
940 $ cd client
941
942 We can now share theses drafts changesets:
943
944 $ hg push ../non-publishing-server -r tools
945 pushing to ../non-publishing-server
946 searching for changes
947 adding changesets
948 adding manifests
949 adding file changes
950 added 4 changesets with 4 changes to 1 files (+1 heads)
951 8 new obsolescence markers
952
953 Pushing the new topic branch to a non publishing server did not required
954 --force. As long as new heads are on their own topic, Mercurial will not
955 complains about them.
956
957 From another client, we will gets them with their topic:
958
959 $ cd ../other-client
960
961 $ hg pull ../non-publishing-server
962 pulling from ../non-publishing-server
963 searching for changes
964 adding changesets
965 adding manifests
966 adding file changes
967 added 4 changesets with 4 changes to 1 files (+1 heads)
968 8 new obsolescence markers
969 (run 'hg heads' to see heads)
970
971 $ hg topics --verbose
972 tools (on branch: default, 4 changesets, 2 behind)
973
974 $ hg up tools
975 switching to topic tools
976 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
977
978 $ hg stack
979 ### topic: tools
980 ### branch: default, 2 behind
981 t4@ Adding drill (current)
982 t3: Adding saw
983 t2: Adding nails
984 t1: Adding hammer to the shopping list
985 t0^ add a pair of shoes (base)
986
987 We can also add new changesets and share them:
988
989 $ echo screws >> shopping
990
991 $ hg commit -A -m "Adding screws"
992
993 $ hg push ../non-publishing-server
994 pushing to ../non-publishing-server
995 searching for changes
996 adding changesets
997 adding manifests
998 adding file changes
999 added 1 changesets with 1 changes to 1 files
1000
1001 And retrieve them on the first client:
1002
1003 $ cd ../client
1004
1005 $ hg pull ../non-publishing-server
1006 pulling from ../non-publishing-server
1007 searching for changes
1008 adding changesets
1009 adding manifests
1010 adding file changes
1011 added 1 changesets with 1 changes to 1 files
1012 (run 'hg update' to get a working copy)
1013
1014 $ hg update
1015 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1016
1017 $ hg stack
1018 ### topic: tools
1019 ### branch: default, 2 behind
1020 t5@ Adding screws (current)
1021 t4: Adding drill
1022 t3: Adding saw
1023 t2: Adding nails
1024 t1: Adding hammer to the shopping list
1025 t0^ add a pair of shoes (base)