comparison tests/test-strip.t @ 33331:4bae3c117b57

scmutil: make cleanupnodes delete divergent bookmarks cleanupnodes takes care of bookmark movement, and bookmark movement could cause bookmark divergent resolution as a side effect. This patch adds such bookmark divergent resolution logic so future rebase migration will be easier. The revset is carefully written to be equivalent to what rebase does today. Although I think it might make sense to remove divergent bookmarks more aggressively, for example: F book@1 | E book@2 | | D book | | | C |/ B book@3 | A When rebase -s C -d E, "book@1" will be removed, "book@3" will be kept, and the end result is: D book | C | F | E book@2 (?) | B book@3 | A The question is should we keep book@2? The current logic keeps it. If we choose not to (makes some sense to me), the "deleterevs" revset could be simplified to "newnode % oldnode". For now, I just make it compatible with the existing behavior. If we want to make the "deleterevs" revset simpler, we can always do it in the future.
author Jun Wu <quark@fb.com>
date Mon, 26 Jun 2017 13:13:51 -0700
parents 65cadeea6c22
children e07c5740eaaa
comparison
equal deleted inserted replaced
33330:ba43e5ee9c6d 33331:4bae3c117b57
1000 > C H G 1000 > C H G
1001 > EOS 1001 > EOS
1002 $ for i in B C D F G I Z; do 1002 $ for i in B C D F G I Z; do
1003 > hg bookmark -i -r $i b-$i 1003 > hg bookmark -i -r $i b-$i
1004 > done 1004 > done
1005 $ hg bookmark -i -r E 'b-F@divergent1'
1006 $ hg bookmark -i -r H 'b-F@divergent2'
1007 $ hg bookmark -i -r G 'b-F@divergent3'
1005 $ cp -R . ../scmutilcleanup.obsstore 1008 $ cp -R . ../scmutilcleanup.obsstore
1006 1009
1007 $ cat > $TESTTMP/scmutilcleanup.py <<EOF 1010 $ cat > $TESTTMP/scmutilcleanup.py <<EOF
1008 > from mercurial import scmutil 1011 > from mercurial import scmutil
1009 > def reposetup(ui, repo): 1012 > def reposetup(ui, repo):
1023 $ hg log -r . -T '\n' --config extensions.t=$TESTTMP/scmutilcleanup.py 1026 $ hg log -r . -T '\n' --config extensions.t=$TESTTMP/scmutilcleanup.py
1024 warning: orphaned descendants detected, not stripping 112478962961, 1fc8102cda62, 26805aba1e60 1027 warning: orphaned descendants detected, not stripping 112478962961, 1fc8102cda62, 26805aba1e60
1025 saved backup bundle to $TESTTMP/scmutilcleanup/.hg/strip-backup/f585351a92f8-73fb7c03-replace.hg (glob) 1028 saved backup bundle to $TESTTMP/scmutilcleanup/.hg/strip-backup/f585351a92f8-73fb7c03-replace.hg (glob)
1026 1029
1027 $ hg log -G -T '{rev}:{node|short} {desc} {bookmarks}' -r 'sort(all(), topo)' 1030 $ hg log -G -T '{rev}:{node|short} {desc} {bookmarks}' -r 'sort(all(), topo)'
1028 o 8:1473d4b996d1 G2 b-G 1031 o 8:1473d4b996d1 G2 b-F@divergent3 b-G
1029 | 1032 |
1030 | o 7:d94e89b773b6 F2 b-F 1033 | o 7:d94e89b773b6 F2 b-F
1031 | | 1034 | |
1032 | o 5:7fe5bac4c918 H 1035 | o 5:7fe5bac4c918 H
1033 |/| 1036 |/|
1034 | o 3:7fb047a69f22 E 1037 | o 3:7fb047a69f22 E b-F@divergent1
1035 | | 1038 | |
1036 | | o 6:7c78f703e465 D2 b-D 1039 | | o 6:7c78f703e465 D2 b-D
1037 | | | 1040 | | |
1038 | | o 4:26805aba1e60 C 1041 | | o 4:26805aba1e60 C
1039 | | | 1042 | | |
1046 $ hg bookmark 1049 $ hg bookmark
1047 b-B 0:426bada5c675 1050 b-B 0:426bada5c675
1048 b-C 0:426bada5c675 1051 b-C 0:426bada5c675
1049 b-D 6:7c78f703e465 1052 b-D 6:7c78f703e465
1050 b-F 7:d94e89b773b6 1053 b-F 7:d94e89b773b6
1054 b-F@divergent1 3:7fb047a69f22
1055 b-F@divergent3 8:1473d4b996d1
1051 b-G 8:1473d4b996d1 1056 b-G 8:1473d4b996d1
1052 b-I 0:426bada5c675 1057 b-I 0:426bada5c675
1053 b-Z -1:000000000000 1058 b-Z -1:000000000000
1054 1059
1055 Test the above using obsstore "by the way". Not directly related to strip, but 1060 Test the above using obsstore "by the way". Not directly related to strip, but
1064 1069
1065 $ hg log -r . -T '\n' --config extensions.t=$TESTTMP/scmutilcleanup.py 1070 $ hg log -r . -T '\n' --config extensions.t=$TESTTMP/scmutilcleanup.py
1066 1071
1067 $ rm .hg/localtags 1072 $ rm .hg/localtags
1068 $ hg log -G -T '{rev}:{node|short} {desc} {bookmarks}' -r 'sort(all(), topo)' 1073 $ hg log -G -T '{rev}:{node|short} {desc} {bookmarks}' -r 'sort(all(), topo)'
1069 o 12:1473d4b996d1 G2 b-G 1074 o 12:1473d4b996d1 G2 b-F@divergent3 b-G
1070 | 1075 |
1071 | o 11:d94e89b773b6 F2 b-F 1076 | o 11:d94e89b773b6 F2 b-F
1072 | | 1077 | |
1073 | o 8:7fe5bac4c918 H 1078 | o 8:7fe5bac4c918 H
1074 |/| 1079 |/|
1075 | o 4:7fb047a69f22 E 1080 | o 4:7fb047a69f22 E b-F@divergent1
1076 | | 1081 | |
1077 | | o 10:7c78f703e465 D2 b-D 1082 | | o 10:7c78f703e465 D2 b-D
1078 | | | 1083 | | |
1079 | | x 6:26805aba1e60 C 1084 | | x 6:26805aba1e60 C
1080 | | | 1085 | | |