comparison tests/test-evolve.t @ 1358:3f5db977d46f

evolve: add a more complex test for evolve --rev The previous tests of evolve --rev would have passed with an ordering of revs by increasing revision numbers. This patch adds a test that would fail if that was what we were doing and therefore tests the implementation better.
author Laurent Charignon <lcharignon@fb.com>
date Tue, 02 Jun 2015 15:23:50 -0700
parents 3bb7a080da4d
children 82dd98428b8d
comparison
equal deleted inserted replaced
1357:3bb7a080da4d 1358:3f5db977d46f
20 > echo "$1" > "$1" 20 > echo "$1" > "$1"
21 > hg add "$1" 21 > hg add "$1"
22 > hg ci -m "add $1" 22 > hg ci -m "add $1"
23 > } 23 > }
24 24
25 $ mkstack() {
26 > # Creates a stack of commit based on $1 with messages from $2, $3 ..
27 > hg update $1 -C
28 > shift
29 > mkcommits $*
30 > }
31
25 $ glog() { 32 $ glog() {
26 > hg glog --template '{rev}:{node|short}@{branch}({phase}) {desc|firstline}\n' "$@" 33 > hg glog --template '{rev}:{node|short}@{branch}({phase}) {desc|firstline}\n' "$@"
34 > }
35
36 $ shaof() {
37 > hg log -T {node} -r "first(desc($1))"
38 > }
39
40 $ mkcommits() {
41 > for i in $@; do mkcommit $i ; done
27 > } 42 > }
28 43
29 various init 44 various init
30 45
31 $ hg init local 46 $ hg init local
1076 atop:[25] add j1 1091 atop:[25] add j1
1077 move:[23] add j3 1092 move:[23] add j3
1078 atop:[26] add j2 1093 atop:[26] add j2
1079 working directory is now at 928e4c317356 1094 working directory is now at 928e4c317356
1080 1095
1096 Cleanup to make the tree cleaner
1097
1098 $ hg prune 20
1099 1 changesets pruned
1100 $ hg prune 26::
1101 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1102 working directory now at 4c0bc042ef3b
1103 2 changesets pruned
1104
1105 evolve --rev reorders the rev to solve instability. Harder case, obsolescence
1106 accross three stacks in growing rev numbers.
1107 $ hg up -C 25
1108 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1109 $ mkstack 25 s1_ s2_ s3_ >/dev/null
1110 $ mkstack 25 s1prime s2prime >/dev/null
1111 $ mkstack 25 s1second >/dev/null
1112 $ hg prune `shaof s1_` -s `shaof s1prime`
1113 1 changesets pruned
1114 2 new unstable changesets
1115 $ hg prune `shaof s1prime` -s `shaof s1second`
1116 1 changesets pruned
1117 1 new unstable changesets
1118 $ hg prune `shaof s2_` -s `shaof s2prime`
1119 1 changesets pruned
1120
1121 $ glog -r "25::"
1122 @ 33:17b5b6ab3f43@default(draft) add s1second
1123 |
1124 | o 32:d694d85de729@default(draft) add s2prime
1125 | |
1126 | x 31:1ae988394dc5@default(draft) add s1prime
1127 |/
1128 | o 30:819245647e79@default(draft) add s3_
1129 | |
1130 | x 29:07a5fc5c1502@default(draft) add s2_
1131 | |
1132 | x 28:5ccaf4765b80@default(draft) add s1_
1133 |/
1134 o 25:4c0bc042ef3b@default(draft) add j1
1135 |
1136
1137 $ hg evolve --rev "25::"
1138 move:[32] add s2prime
1139 atop:[33] add s1second
1140 move:[30] add s3_
1141 atop:[34] add s2prime
1142 working directory is now at dc79646e43b4
1143 $ glog -r "25::"
1144 @ 35:dc79646e43b4@default(draft) add s3_
1145 |
1146 o 34:96f3ff6b7106@default(draft) add s2prime
1147 |
1148 o 33:17b5b6ab3f43@default(draft) add s1second
1149 |
1150 o 25:4c0bc042ef3b@default(draft) add j1
1151 |
1152
1153 $ hg prune 33::
1154 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
1155 working directory now at 4c0bc042ef3b
1156 3 changesets pruned
1157