1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317
|
#!/bin/sh
echo "[extensions]" >> $HGRCPATH
echo "graphlog=" >> $HGRCPATH
mkdir a
cd a
hg init
echo foo > t1
hg add t1
hg commit -m "1" -d "1000000 0"
cd ..
hg clone a b
cd a
echo foo > t2
hg add t2
hg commit -m "2" -d "1000000 0"
cd ../b
echo foo > t3
hg add t3
hg commit -m "3" -d "1000000 0"
hg push ../a
hg pull ../a
hg push ../a
hg merge
hg commit -m "4" -d "1000000 0"
hg push ../a
cd ..
hg init c
cd c
for i in 0 1 2; do
echo $i >> foo
hg ci -Am $i -d "1000000 0"
done
cd ..
hg clone c d
cd d
for i in 0 1; do
hg co -C $i
echo d-$i >> foo
hg ci -m d-$i -d "1000000 0"
done
HGMERGE=true hg merge 3
hg ci -m c-d -d "1000000 0"
hg push ../c; echo $?
hg push -r 2 ../c; echo $?
hg push -r 3 ../c; echo $?
hg push -r 3 -r 4 ../c; echo $?
hg push -f -r 3 -r 4 ../c; echo $?
hg push -r 5 ../c; echo $?
hg in ../c
echo % issue 450
hg init ../e
hg push -r 0 ../e ; echo $?
hg push -r 1 ../e ; echo $?
cd ..
echo % issue 736
hg init f
cd f
hg -q branch a
echo 0 > foo
hg -q ci -d "1000000 0" -Am 0
echo 1 > foo
hg -q ci -d "1000000 0" -m 1
hg -q up 0
echo 2 > foo
hg -q ci -d "1000000 0" -m 2
hg -q up 0
hg -q branch b
echo 3 > foo
hg -q ci -d "1000000 0" -m 3
cd ..
hg -q clone f g
cd g
echo % push on existing branch and new branch
hg -q up 1
echo 4 > foo
hg -q ci -d "1000000 0" -m 4
hg -q up 0
echo 5 > foo
hg -q branch c
hg -q ci -d "1000000 0" -m 5
hg push ../f; echo $?
hg push -r 4 -r 5 ../f; echo $?
echo % multiple new branches
hg -q branch d
echo 6 > foo
hg -q ci -d "1000000 0" -m 6
hg push ../f; echo $?
hg push -r 4 -r 6 ../f; echo $?
cd ../g
echo % fail on multiple head push
hg -q up 1
echo 7 > foo
hg -q ci -d "1000000 0" -m 7
hg push -r 4 -r 7 ../f; echo $?
echo % push replacement head on existing branches
hg -q up 3
echo 8 > foo
hg -q ci -d "1000000 0" -m 8
hg push -r 7 -r 8 ../f; echo $?
echo % merge of branch a to other branch b followed by unrelated push on branch a
hg -q up 7
HGMERGE=true hg -q merge 8
hg -q ci -d "1000000 0" -m 9
hg -q up 8
echo 10 > foo
hg -q ci -d "1000000 0" -m 10
hg push -r 9 ../f; echo $?
hg push -r 10 ../f; echo $?
echo % cheating the counting algorithm
hg -q up 9
HGMERGE=true hg -q merge 2
hg -q ci -d "1000000 0" -m 11
hg -q up 1
echo 12 > foo
hg -q ci -d "1000000 0" -m 12
hg push -r 11 -r 12 ../f; echo $?
echo % failed push of new named branch
echo 12 > foo
hg -q ci -d "1000000 0" -m 12a
hg -q up 11
echo 13 > foo
hg -q branch e
hg -q ci -d "1000000 0" -m 13d
hg push -r 12 -r 13 ../f; echo $?
echo % using --new-branch to push new named branch
hg push --new-branch -r 12 -r 13 ../f; echo $?
echo % checking prepush logic does not allow silently pushing multiple new heads
cd ..
hg init h
echo init > h/init
hg -R h ci -Am init
echo a > h/a
hg -R h ci -Am a
hg clone h i
hg -R h up 0
echo b > h/b
hg -R h ci -Am b
hg -R i up 0
echo c > i/c
hg -R i ci -Am c
hg -R i push h
echo
echo % check prepush logic with merged branches
hg init j
hg -R j branch a
echo init > j/foo
hg -R j ci -Am init
hg clone j k
echo a1 > j/foo
hg -R j ci -m a1
hg -R k branch b
echo b > k/foo
hg -R k ci -m b
hg -R k up 0
hg -R k merge b
hg -R k ci -m merge
hg -R k push -r a j
echo
echo % prepush -r should not allow you to sneak in new heads
hg init l
cd l
echo a >> foo
hg -q add foo
hg -q branch a
hg -q ci -d '0 0' -ma
hg -q up null
echo a >> foo
hg -q add foo
hg -q branch b
hg -q ci -d '0 0' -mb
cd ..
hg -q clone l m -u a
cd m
hg -q merge b
hg -q ci -d '0 0' -mmb
hg -q up 0
echo a >> foo
hg -q ci -ma2
hg -q up 2
echo a >> foo
hg -q branch -f b
hg -q ci -d '0 0' -mb2
hg -q merge 3
hg -q ci -d '0 0' -mma
hg push ../l -b b
cd ..
echo % check prepush with new branch head on former topo non-head
hg init n
cd n
hg branch A
echo a >a
hg ci -Ama
hg branch B
echo b >b
hg ci -Amb
# b is now branch head of B, and a topological head
# a is now branch head of A, but not a topological head
hg clone . inner
cd inner
hg up B
echo b1 >b1
hg ci -Amb1
# in the clone b1 is now the head of B
cd ..
hg up 0
echo a2 >a2
hg ci -Ama2
# a2 is now the new branch head of A, and a new topological head
# it replaces a former inner branch head, so it should at most warn about A, not B
echo %% glog of local
hg glog --template "{rev}: {branches} {desc}\n"
echo %% glog of remote
hg glog -R inner --template "{rev}: {branches} {desc}\n"
echo %% outgoing
hg out inner --template "{rev}: {branches} {desc}\n"
hg push inner
cd ..
echo % check prepush with new branch head on former topo head
hg init o
cd o
hg branch A
echo a >a
hg ci -Ama
hg branch B
echo b >b
hg ci -Amb
# b is now branch head of B, and a topological head
hg up 0
echo a1 >a1
hg ci -Ama1
# a1 is now branch head of A, and a topological head
hg clone . inner
cd inner
hg up B
echo b1 >b1
hg ci -Amb1
# in the clone b1 is now the head of B
cd ..
echo a2 >a2
hg ci -Ama2
# a2 is now the new branch head of A, and a topological head
# it replaces a former topological and branch head, so this should not warn
echo %% glog of local
hg glog --template "{rev}: {branches} {desc}\n"
echo %% glog of remote
hg glog -R inner --template "{rev}: {branches} {desc}\n"
echo %% outgoing
hg out inner --template "{rev}: {branches} {desc}\n"
hg push inner
cd ..
echo % check prepush with new branch head and new child of former branch head
echo % but child is on different branch
hg init p
cd p
hg branch A
echo a0 >a
hg ci -Ama0
echo a1 >a
hg ci -ma1
hg up null
hg branch B
echo b0 >b
hg ci -Amb0
echo b1 >b
hg ci -mb1
hg clone . inner
hg up A
hg branch -f B
echo a3 >a
hg ci -ma3
hg up 3
hg branch -f A
echo b3 >b
hg ci -mb3
echo %% glog of local
hg glog --template "{rev}: {branches} {desc}\n"
echo %% glog of remote
hg glog -R inner --template "{rev}: {branches} {desc}\n"
echo %% outgoing
hg out inner --template "{rev}: {branches} {desc}\n"
hg push inner
hg push inner -r4 -r5
hg in inner
cd ..
exit 0
|