1#testcases concurrent-strict concurrent-check-related 2 3 $ . "$TESTDIR/testlib/topic_setup.sh" 4 5 $ cat << EOF >> $HGRCPATH 6 > [ui] 7 > logtemplate = {rev} {branch} {get(namespaces, "topics")} {phase} {desc|firstline}\n 8 > ssh = "$PYTHON" "$RUNTESTDIR/dummyssh" 9 > EOF 10 11#if concurrent-strict 12 $ cat << EOF >> $HGRCPATH 13 > [server] 14 > concurrent-push-mode = strict 15 > EOF 16#endif 17 18#if concurrent-check-related 19 $ cat << EOF >> $HGRCPATH 20 > [server] 21 > concurrent-push-mode = check-related 22 > EOF 23#endif 24 25 $ hg init main 26 $ hg init draft 27 $ cat << EOF >> draft/.hg/hgrc 28 > [phases] 29 > publish = no 30 > EOF 31 $ hg clone main client 32 updating to branch default 33 0 files updated, 0 files merged, 0 files removed, 0 files unresolved 34 $ cat << EOF >> client/.hg/hgrc 35 > [paths] 36 > draft = ../draft 37 > EOF 38 39 40Testing core behavior to make sure we did not break anything 41============================================================ 42 43Pushing a first changeset 44 45 $ cd client 46 $ echo aaa > aaa 47 $ hg add aaa 48 $ hg commit -m 'CA' 49 $ hg outgoing -G 50 comparing with $TESTTMP/main (glob) 51 searching for changes 52 @ 0 default draft CA 53 54 $ hg push 55 pushing to $TESTTMP/main (glob) 56 searching for changes 57 adding changesets 58 adding manifests 59 adding file changes 60 added 1 changesets with 1 changes to 1 files 61 62Pushing two heads 63 64 $ echo aaa > bbb 65 $ hg add bbb 66 $ hg commit -m 'CB' 67 $ echo aaa > ccc 68 $ hg up 'desc(CA)' 69 0 files updated, 0 files merged, 1 files removed, 0 files unresolved 70 $ hg add ccc 71 $ hg commit -m 'CC' 72 created new head 73 (consider using topic for lightweight branches. See 'hg help topic') 74 $ hg outgoing -G 75 comparing with $TESTTMP/main (glob) 76 searching for changes 77 @ 2 default draft CC 78 79 o 1 default draft CB 80 81 $ hg push 82 pushing to $TESTTMP/main (glob) 83 searching for changes 84 abort: push creates new remote head 9fe81b7f425d 85 (merge or see 'hg help push' for details about pushing new heads) 86 [20] 87 $ hg outgoing -r 'desc(CB)' -G 88 comparing with $TESTTMP/main (glob) 89 searching for changes 90 o 1 default draft CB 91 92 $ hg push -r 'desc(CB)' 93 pushing to $TESTTMP/main (glob) 94 searching for changes 95 adding changesets 96 adding manifests 97 adding file changes 98 added 1 changesets with 1 changes to 1 files 99 100Pushing a new branch 101 102 $ hg branch mountain 103 marked working directory as branch mountain 104 (branches are permanent and global, did you want a bookmark?) 105 $ hg commit --amend 106 $ hg outgoing -G 107 comparing with $TESTTMP/main (glob) 108 searching for changes 109 @ 3 mountain draft CC 110 111 $ hg push 112 pushing to $TESTTMP/main (glob) 113 searching for changes 114 abort: push creates new remote branches: mountain 115 (use 'hg push --new-branch' to create new remote branches) 116 [20] 117 $ hg push --new-branch 118 pushing to $TESTTMP/main (glob) 119 searching for changes 120 adding changesets 121 adding manifests 122 adding file changes 123 added 1 changesets with 1 changes to 1 files (+1 heads) 124 1 new obsolescence markers 125 126Including on non-publishing 127 128 $ hg push --new-branch draft 129 pushing to $TESTTMP/draft (glob) 130 searching for changes 131 adding changesets 132 adding manifests 133 adding file changes 134 added 3 changesets with 3 changes to 3 files (+1 heads) 135 1 new obsolescence markers 136 137Testing topic behavior 138====================== 139 140Local peer tests 141---------------- 142 143 $ hg up -r 'desc(CA)' 144 0 files updated, 0 files merged, 1 files removed, 0 files unresolved 145 $ hg topic babar 146 marked working directory as topic: babar 147 $ echo aaa > ddd 148 $ hg add ddd 149 $ hg commit -m 'CD' 150 active topic 'babar' grew its first changeset 151 (see 'hg help topics' for more information) 152 $ hg log -G # keep track of phase because I saw some strange bug during developement 153 @ 4 default babar draft CD 154 | 155 | o 3 mountain public CC 156 |/ 157 | o 1 default public CB 158 |/ 159 o 0 default public CA 160 161 162Pushing a new topic to a non publishing server should not be seen as a new head 163 164 $ hg push draft 165 pushing to $TESTTMP/draft (glob) 166 searching for changes 167 adding changesets 168 adding manifests 169 adding file changes 170 added 1 changesets with 1 changes to 1 files (+1 heads) 171 $ hg log -G 172 @ 4 default babar draft CD 173 | 174 | o 3 mountain public CC 175 |/ 176 | o 1 default public CB 177 |/ 178 o 0 default public CA 179 180push --topic 181 182 $ hg log -G -R $TESTTMP/draft 183 o 3 default babar draft CD 184 | 185 | o 2 mountain public CC 186 |/ 187 | o 1 default public CB 188 |/ 189 o 0 default public CA 190 191 $ echo bbb >> aaa 192 $ hg commit -m "C'A" 193 $ hg up 1 194 2 files updated, 0 files merged, 1 files removed, 0 files unresolved 195 $ hg topic --clear 196 $ echo bbb >> bbb 197 $ hg commit -m "C'B" 198 $ hg log -G 199 @ 6 default draft C'B 200 | 201 | o 5 default babar draft C'A 202 | | 203 | o 4 default babar draft CD 204 | | 205 | | o 3 mountain public CC 206 | |/ 207 o | 1 default public CB 208 |/ 209 o 0 default public CA 210 211 212 $ hg outgoing draft --topic nonexistent 213 abort: topic 'nonexistent' does not exist 214 [255] 215 $ hg push draft --topic nonexistent 216 abort: topic 'nonexistent' does not exist 217 [255] 218 219 $ hg up babar 220 switching to topic babar 221 2 files updated, 0 files merged, 1 files removed, 0 files unresolved 222 $ hg outgoing draft --topic . 223 comparing with $TESTTMP/draft 224 searching for changes 225 5 default babar draft C'A 226 227 $ hg outgoing draft --topic babar 228 comparing with $TESTTMP/draft 229 searching for changes 230 5 default babar draft C'A 231 $ hg push draft --topic babar 232 pushing to $TESTTMP/draft 233 searching for changes 234 adding changesets 235 adding manifests 236 adding file changes 237 added 1 changesets with 1 changes to 1 files 238 $ hg log -G -R $TESTTMP/draft 239 o 4 default babar draft C'A 240 | 241 o 3 default babar draft CD 242 | 243 | o 2 mountain public CC 244 |/ 245 | o 1 default public CB 246 |/ 247 o 0 default public CA 248 249 $ hg strip --config extensions.strip= --no-backup -r 7a9e34dbf547: --quiet 250 $ hg strip --config extensions.strip= -R $TESTTMP/draft --no-backup -r 7a9e34dbf547: --quiet 251 252Pushing a new topic to a publishing server should be seen as a new head 253 254 $ hg push 255 pushing to $TESTTMP/main (glob) 256 searching for changes 257 abort: push creates new remote head 67f579af159d 258 (merge or see 'hg help push' for details about pushing new heads) 259 [20] 260 $ hg log -G 261 @ 4 default babar draft CD 262 | 263 | o 3 mountain public CC 264 |/ 265 | o 1 default public CB 266 |/ 267 o 0 default public CA 268 269 270wireprotocol tests 271------------------ 272 273 $ hg up -r 'desc(CA)' 274 0 files updated, 0 files merged, 1 files removed, 0 files unresolved 275 $ hg topic celeste 276 marked working directory as topic: celeste 277 $ echo aaa > eee 278 $ hg add eee 279 $ hg commit -m 'CE' 280 active topic 'celeste' grew its first changeset 281 (see 'hg help topics' for more information) 282 $ hg log -G # keep track of phase because I saw some strange bug during developement 283 @ 5 default celeste draft CE 284 | 285 | o 4 default babar draft CD 286 |/ 287 | o 3 mountain public CC 288 |/ 289 | o 1 default public CB 290 |/ 291 o 0 default public CA 292 293 294Pushing a new topic to a non publishing server without topic -> new head 295 296 $ cat << EOF >> ../draft/.hg/hgrc 297 > [extensions] 298 > topic = ! 299 > EOF 300 $ hg push ssh://user@dummy/draft 301 pushing to ssh://user@dummy/draft 302 searching for changes 303 abort: push creates new remote head 84eaf32db6c3 304 (merge or see 'hg help push' for details about pushing new heads) 305 [20] 306 $ hg log -G 307 @ 5 default celeste draft CE 308 | 309 | o 4 default babar draft CD 310 |/ 311 | o 3 mountain public CC 312 |/ 313 | o 1 default public CB 314 |/ 315 o 0 default public CA 316 317 318Pushing a new topic to a non publishing server should not be seen as a new head 319 320 $ echo 'topic =' >> ../draft/.hg/hgrc 321 $ hg push ssh://user@dummy/draft 322 pushing to ssh://user@dummy/draft 323 searching for changes 324 remote: adding changesets 325 remote: adding manifests 326 remote: adding file changes 327 remote: added 1 changesets with 1 changes to 1 files (+1 heads) 328 $ hg log -G 329 @ 5 default celeste draft CE 330 | 331 | o 4 default babar draft CD 332 |/ 333 | o 3 mountain public CC 334 |/ 335 | o 1 default public CB 336 |/ 337 o 0 default public CA 338 339 340Pushing a new topic to a publishing server should be seen as a new head 341 342 $ hg push ssh://user@dummy/main 343 pushing to ssh://user@dummy/main 344 searching for changes 345 abort: push creates new remote head 67f579af159d 346 (merge or see 'hg help push' for details about pushing new heads) 347 [20] 348 $ hg log -G 349 @ 5 default celeste draft CE 350 | 351 | o 4 default babar draft CD 352 |/ 353 | o 3 mountain public CC 354 |/ 355 | o 1 default public CB 356 |/ 357 o 0 default public CA 358 359 360Check that we reject multiple heads on the same topic 361----------------------------------------------------- 362 363 $ hg up 'desc(CB)' 364 1 files updated, 0 files merged, 1 files removed, 0 files unresolved 365 $ hg topic babar 366 marked working directory as topic: babar 367 $ echo aaa > fff 368 $ hg add fff 369 $ hg commit -m 'CF' 370 $ hg log -G 371 @ 6 default babar draft CF 372 | 373 | o 5 default celeste draft CE 374 | | 375 | | o 4 default babar draft CD 376 | |/ 377 | | o 3 mountain public CC 378 | |/ 379 o | 1 default public CB 380 |/ 381 o 0 default public CA 382 383 384 $ hg push draft 385 pushing to $TESTTMP/draft (glob) 386 searching for changes 387 abort: push creates new remote head f0bc62a661be on branch 'default:babar' 388 (merge or see 'hg help push' for details about pushing new heads) 389 [20] 390 391Multiple heads on a branch merged into a topic branch 392----------------------------------------------------- 393 394 $ hg up 'desc(CA)' 395 0 files updated, 0 files merged, 2 files removed, 0 files unresolved 396 $ echo aaa > ggg 397 $ hg add ggg 398 $ hg commit -m 'CG' 399 created new head 400 (consider using topic for lightweight branches. See 'hg help topic') 401 $ hg up 'desc(CF)' 402 switching to topic babar 403 2 files updated, 0 files merged, 1 files removed, 0 files unresolved 404 $ hg merge 'desc(CG)' 405 1 files updated, 0 files merged, 0 files removed, 0 files unresolved 406 (branch merge, don't forget to commit) 407 $ hg commit -m 'CM' 408 $ hg log -G 409 @ 8 default babar draft CM 410 |\ 411 | o 7 default draft CG 412 | | 413 o | 6 default babar draft CF 414 | | 415 | | o 5 default celeste draft CE 416 | |/ 417 | | o 4 default babar draft CD 418 | |/ 419 | | o 3 mountain public CC 420 | |/ 421 o | 1 default public CB 422 |/ 423 o 0 default public CA 424 425 426Reject when pushing to draft 427 428 $ hg push draft -r . 429 pushing to $TESTTMP/draft (glob) 430 searching for changes 431 abort: push creates new remote head 4937c4cad39e 432 (merge or see 'hg help push' for details about pushing new heads) 433 [20] 434 435Reject when pushing to publishing 436 437 $ hg push -r . 438 pushing to $TESTTMP/main (glob) 439 searching for changes 440 adding changesets 441 adding manifests 442 adding file changes 443 added 3 changesets with 2 changes to 2 files 444 445 $ cd .. 446 447Test phase move 448=============== 449 450setup, two repos have two small topic branches 451 452 $ hg init repoA 453 $ hg clone repoA repoB 454 updating to branch default 455 0 files updated, 0 files merged, 0 files removed, 0 files unresolved 456 $ cat << EOF >> repoA/.hg/hgrc 457 > [phases] 458 > publish = no 459 > EOF 460 $ cat << EOF >> repoB/.hg/hgrc 461 > [phases] 462 > publish = no 463 > EOF 464 $ cd repoA 465 $ echo aaa > base 466 $ hg add base 467 $ hg commit -m 'CBASE' 468 $ echo aaa > aaa 469 $ hg add aaa 470 $ hg topic topicA 471 marked working directory as topic: topicA 472 $ hg commit -m 'CA' 473 active topic 'topicA' grew its first changeset 474 (see 'hg help topics' for more information) 475 $ hg up 'desc(CBASE)' 476 0 files updated, 0 files merged, 1 files removed, 0 files unresolved 477 $ echo aaa > bbb 478 $ hg add bbb 479 $ hg topic topicB 480 marked working directory as topic: topicB 481 $ hg commit -m 'CB' 482 active topic 'topicB' grew its first changeset 483 (see 'hg help topics' for more information) 484 $ cd .. 485 $ hg push -R repoA repoB 486 pushing to repoB 487 searching for changes 488 adding changesets 489 adding manifests 490 adding file changes 491 added 3 changesets with 3 changes to 3 files (+1 heads) 492 $ hg log -G -R repoA 493 @ 2 default topicB draft CB 494 | 495 | o 1 default topicA draft CA 496 |/ 497 o 0 default draft CBASE 498 499 500We turn a different topic to public on each side, 501 502 $ hg -R repoA phase --public topicA 503 $ hg -R repoB phase --public topicB 504 505Pushing should complain because it would create two heads on default 506 507 $ hg push -R repoA repoB 508 pushing to repoB 509 searching for changes 510 no changes found 511 abort: push creates new heads on branch 'default': bbd9d6199b88 512 [255] 513