This instance will be upgraded to Heptapod 0.21.0rc2 on 2021-04-16 at 14:00 UTC+2 (a few minutes of down time)

test-rebase-collapse.t 15.3 KB
Newer Older
Adrian Buehlmann's avatar
Adrian Buehlmann committed
1 2 3
  $ cat >> $HGRCPATH <<EOF
  > [extensions]
  > rebase=
4
  > mq=
5
  > drawdag=$TESTDIR/drawdag.py
Adrian Buehlmann's avatar
Adrian Buehlmann committed
6
  > 
7 8 9
  > [phases]
  > publish=False
  > 
Adrian Buehlmann's avatar
Adrian Buehlmann committed
10
  > [alias]
11 12
  > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n"
  > tglogp = log -G --template "{rev}: {node|short} {phase} '{desc}' {branches}\n"
Adrian Buehlmann's avatar
Adrian Buehlmann committed
13 14
  > EOF

15 16 17 18 19 20 21 22 23 24 25 26 27
Highest phase of source commits is used:

  $ hg init phase
  $ cd phase
  $ hg debugdrawdag << 'EOF'
  >   D
  >   |
  > F C
  > | |
  > E B
  > |/
  > A
  > EOF
Adrian Buehlmann's avatar
Adrian Buehlmann committed
28

29
  $ hg phase --force --secret D
Alain  Leufroy's avatar
Alain Leufroy committed
30

31 32 33 34 35 36
  $ cat > $TESTTMP/editor.sh <<EOF
  > echo "==== before editing"
  > cat \$1
  > echo "===="
  > echo "edited manually" >> \$1
  > EOF
37
  $ HGEDITOR="sh $TESTTMP/editor.sh" hg rebase --collapse --keepbranches -e --source B --dest F
38 39 40
  rebasing 1:112478962961 B "B"
  rebasing 3:26805aba1e60 C "C"
  rebasing 5:f585351a92f8 D tip "D"
41 42 43 44 45 46 47 48 49 50
  ==== before editing
  Collapsed revision
  * B
  * C
  * D
  
  
  HG: Enter commit message.  Lines beginning with 'HG:' are removed.
  HG: Leave message empty to abort commit.
  HG: --
51
  HG: user: test
52
  HG: branch 'default'
53 54 55
  HG: added B
  HG: added C
  HG: added D
56
  ====
57
  saved backup bundle to $TESTTMP/phase/.hg/strip-backup/112478962961-cb2a9b47-rebase.hg
Adrian Buehlmann's avatar
Adrian Buehlmann committed
58

Alain  Leufroy's avatar
Alain Leufroy committed
59
  $ hg tglogp
60
  o  3: 92fa5f5fe108 secret 'Collapsed revision
Adrian Buehlmann's avatar
Adrian Buehlmann committed
61 62
  |  * B
  |  * C
63 64 65 66
  |  * D
  |
  |
  |  edited manually'
67
  o  2: 64a8289d2492 draft 'F'
Adrian Buehlmann's avatar
Adrian Buehlmann committed
68
  |
69 70 71
  o  1: 7fb047a69f22 draft 'E'
  |
  o  0: 426bada5c675 draft 'A'
Adrian Buehlmann's avatar
Adrian Buehlmann committed
72
  
73
  $ hg manifest --rev tip
Adrian Buehlmann's avatar
Adrian Buehlmann committed
74 75 76 77
  A
  B
  C
  D
78
  E
Adrian Buehlmann's avatar
Adrian Buehlmann committed
79 80 81 82 83
  F

  $ cd ..


84 85 86 87
Merge gets linearized:

  $ hg init linearized-merge
  $ cd linearized-merge
Adrian Buehlmann's avatar
Adrian Buehlmann committed
88

89 90 91 92 93 94 95
  $ hg debugdrawdag << 'EOF'
  > F D
  > |/|
  > C B
  > |/
  > A
  > EOF
Adrian Buehlmann's avatar
Adrian Buehlmann committed
96

97 98
  $ hg phase --force --secret D
  $ hg rebase --source B --collapse --dest F
99 100
  rebasing 1:112478962961 B "B"
  rebasing 3:4e4f9194f9f1 D "D"
101
  saved backup bundle to $TESTTMP/linearized-merge/.hg/strip-backup/112478962961-e389075b-rebase.hg
Adrian Buehlmann's avatar
Adrian Buehlmann committed
102 103

  $ hg tglog
104 105 106 107
  o  3: 5bdc08b7da2b 'Collapsed revision
  |  * B
  |  * D'
  o  2: afc707c82df0 'F'
Adrian Buehlmann's avatar
Adrian Buehlmann committed
108
  |
109
  o  1: dc0947a82db8 'C'
Adrian Buehlmann's avatar
Adrian Buehlmann committed
110
  |
111
  o  0: 426bada5c675 'A'
Adrian Buehlmann's avatar
Adrian Buehlmann committed
112
  
113
  $ hg manifest --rev tip
Adrian Buehlmann's avatar
Adrian Buehlmann committed
114
  A
115 116
  B
  C
Adrian Buehlmann's avatar
Adrian Buehlmann committed
117 118 119 120
  F

  $ cd ..

121 122 123 124 125 126 127 128 129 130 131 132
Custom message:

  $ hg init message
  $ cd message

  $ hg debugdrawdag << 'EOF'
  >   C
  >   |
  > D B
  > |/
  > A
  > EOF
133 134


135
  $ hg rebase --base B -m 'custom message'
136 137 138
  abort: message can only be specified with collapse
  [255]

139 140 141 142
  $ cat > $TESTTMP/checkeditform.sh <<EOF
  > env | grep HGEDITFORM
  > true
  > EOF
143
  $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg rebase --source B --collapse -m 'custom message' -e --dest D
144 145
  rebasing 1:112478962961 B "B"
  rebasing 3:26805aba1e60 C tip "C"
146
  HGEDITFORM=rebase.collapse
147
  saved backup bundle to $TESTTMP/message/.hg/strip-backup/112478962961-f4131707-rebase.hg
148 149

  $ hg tglog
150
  o  2: 2f197b9a08f3 'custom message'
151
  |
152
  o  1: b18e25de2cf5 'D'
153
  |
154
  o  0: 426bada5c675 'A'
155
  
156
  $ hg manifest --rev tip
157
  A
158 159 160
  B
  C
  D
Adrian Buehlmann's avatar
Adrian Buehlmann committed
161 162 163 164 165

  $ cd ..

Rebase and collapse - more than one external (fail):

166 167 168 169 170 171 172 173 174 175 176 177 178 179
  $ hg init multiple-external-parents
  $ cd multiple-external-parents

  $ hg debugdrawdag << 'EOF'
  >   G
  >   |\
  >   | F
  >   | |
  >   D E
  >   |\|
  > H C B
  >  \|/
  >   A
  > EOF
Adrian Buehlmann's avatar
Adrian Buehlmann committed
180

181 182
  $ hg rebase -s C --dest H --collapse
  abort: unable to collapse on top of 3, there is more than one external parent: 1, 6
Adrian Buehlmann's avatar
Adrian Buehlmann committed
183 184 185 186
  [255]

Rebase and collapse - E onto H:

187
  $ hg rebase -s E --dest H --collapse # root (E) is not a merge
188 189 190
  rebasing 5:49cb92066bfd E "E"
  rebasing 6:11abe3fb10b8 F "F"
  rebasing 7:64e264db77f0 G tip "G"
191
  saved backup bundle to $TESTTMP/multiple-external-parents/.hg/strip-backup/49cb92066bfd-ee8a8a79-rebase.hg
Adrian Buehlmann's avatar
Adrian Buehlmann committed
192 193

  $ hg tglog
194 195 196 197 198 199 200
  o    5: 8b2315790719 'Collapsed revision
  |\   * E
  | |  * F
  | |  * G'
  | o    4: 4e4f9194f9f1 'D'
  | |\
  o | |  3: 575c4b5ec114 'H'
201
  | | |
202 203 204
  +---o  2: dc0947a82db8 'C'
  | |
  | o  1: 112478962961 'B'
Adrian Buehlmann's avatar
Adrian Buehlmann committed
205
  |/
206
  o  0: 426bada5c675 'A'
Adrian Buehlmann's avatar
Adrian Buehlmann committed
207
  
208
  $ hg manifest --rev tip
Adrian Buehlmann's avatar
Adrian Buehlmann committed
209 210 211 212
  A
  C
  E
  F
213
  H
Adrian Buehlmann's avatar
Adrian Buehlmann committed
214 215 216 217

  $ cd ..


218 219 220


Test that branchheads cache is updated correctly when doing a strip in which
221 222 223 224
the parent of the ancestor node to be stripped does not become a head and also,
the parent of a node that is a child of the node stripped becomes a head (node
3). The code is now much simpler and we could just test a simpler scenario
We keep it the test this way in case new complexity is injected.
225

226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
Create repo b:

  $ hg init branch-heads
  $ cd branch-heads

  $ hg debugdrawdag << 'EOF'
  >   G
  >   |\
  >   | F
  >   | |
  >   D E
  >   |\|
  > H C B
  >  \|/
  >   A
  > EOF
242 243

  $ hg heads --template="{rev}:{node} {branch}\n"
244 245
  7:64e264db77f061f16d9132b70c5a58e2461fb630 default
  3:575c4b5ec114d64b681d33f8792853568bfb2b2c default
246

247 248 249 250
  $ cat $TESTTMP/branch-heads/.hg/cache/branch2-served
  64e264db77f061f16d9132b70c5a58e2461fb630 7
  575c4b5ec114d64b681d33f8792853568bfb2b2c o default
  64e264db77f061f16d9132b70c5a58e2461fb630 o default
251 252

  $ hg strip 4
253
  saved backup bundle to $TESTTMP/branch-heads/.hg/strip-backup/4e4f9194f9f1-5ec4b5e6-backup.hg
254

255 256 257 258 259
  $ cat $TESTTMP/branch-heads/.hg/cache/branch2-served
  11abe3fb10b8689b560681094b17fe161871d043 5
  dc0947a82db884575bb76ea10ac97b08536bfa03 o default
  575c4b5ec114d64b681d33f8792853568bfb2b2c o default
  11abe3fb10b8689b560681094b17fe161871d043 o default
260 261

  $ hg heads --template="{rev}:{node} {branch}\n"
262 263 264
  5:11abe3fb10b8689b560681094b17fe161871d043 default
  3:575c4b5ec114d64b681d33f8792853568bfb2b2c default
  2:dc0947a82db884575bb76ea10ac97b08536bfa03 default
265 266 267 268 269

  $ cd ..



270
Preserves external parent
271

272 273
  $ hg init external-parent
  $ cd external-parent
274

275 276 277 278 279 280 281 282 283 284 285 286 287
  $ hg debugdrawdag << 'EOF'
  >   H
  >   |\
  >   | G
  >   | |
  >   | F # F/E = F\n
  >   | |
  >   D E # D/D = D\n
  >   |\|
  > I C B
  >  \|/
  >   A
  > EOF
288

289
  $ hg rebase -s F --dest I --collapse # root (F) is not a merge
290
  rebasing 6:c82b08f646f1 F "F"
291 292 293
  file 'E' was deleted in local [dest] but was modified in other [source].
  You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
  What do you want to do? u
294
  unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
295
  [240]
296 297 298 299 300 301

  $ echo F > E
  $ hg resolve -m
  (no more unresolved files)
  continue: hg rebase --continue
  $ hg rebase -c
302 303 304
  rebasing 6:c82b08f646f1 F "F"
  rebasing 7:a6db7fa104e1 G "G"
  rebasing 8:e1d201b72d91 H tip "H"
305
  saved backup bundle to $TESTTMP/external-parent/.hg/strip-backup/c82b08f646f1-f2721fbf-rebase.hg
Adrian Buehlmann's avatar
Adrian Buehlmann committed
306 307

  $ hg tglog
308 309 310 311 312
  o    6: 681daa3e686d 'Collapsed revision
  |\   * F
  | |  * G
  | |  * H'
  | | o  5: 49cb92066bfd 'E'
Adrian Buehlmann's avatar
Adrian Buehlmann committed
313
  | | |
314
  | o |  4: 09143c0bf13e 'D'
Adrian Buehlmann's avatar
Adrian Buehlmann committed
315
  | |\|
316 317 318
  o | |  3: 08ebfeb61bac 'I'
  | | |
  | o |  2: dc0947a82db8 'C'
Adrian Buehlmann's avatar
Adrian Buehlmann committed
319
  |/ /
320
  | o  1: 112478962961 'B'
Adrian Buehlmann's avatar
Adrian Buehlmann committed
321
  |/
322
  o  0: 426bada5c675 'A'
Adrian Buehlmann's avatar
Adrian Buehlmann committed
323
  
324
  $ hg manifest --rev tip
Adrian Buehlmann's avatar
Adrian Buehlmann committed
325 326 327 328
  A
  C
  D
  E
329
  F
Adrian Buehlmann's avatar
Adrian Buehlmann committed
330 331 332
  G
  I

333
  $ hg up tip -q
Adrian Buehlmann's avatar
Adrian Buehlmann committed
334 335 336 337 338
  $ cat E
  F

  $ cd ..

339 340 341 342 343 344 345 346 347 348 349
Rebasing from multiple bases:

  $ hg init multiple-bases
  $ cd multiple-bases
  $ hg debugdrawdag << 'EOF'
  >   C B
  > D |/
  > |/
  > A
  > EOF
  $ hg rebase --collapse -r 'B+C' -d D
350 351
  rebasing 1:fc2b737bb2e5 B "B"
  rebasing 2:dc0947a82db8 C "C"
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408
  saved backup bundle to $TESTTMP/multiple-bases/.hg/strip-backup/dc0947a82db8-b0c1a7ea-rebase.hg
  $ hg tglog
  o  2: 2127ae44d291 'Collapsed revision
  |  * B
  |  * C'
  o  1: b18e25de2cf5 'D'
  |
  o  0: 426bada5c675 'A'
  
  $ cd ..

With non-contiguous commits:

  $ hg init non-contiguous
  $ cd non-contiguous
  $ cat >> .hg/hgrc <<EOF
  > [experimental]
  > evolution=all
  > EOF

  $ hg debugdrawdag << 'EOF'
  > F
  > |
  > E
  > |
  > D
  > |
  > C
  > |
  > B G
  > |/
  > A
  > EOF

BROKEN: should be allowed
  $ hg rebase --collapse -r 'B+D+F' -d G
  abort: unable to collapse on top of 2, there is more than one external parent: 3, 5
  [255]
  $ cd ..


  $ hg init multiple-external-parents-2
  $ cd multiple-external-parents-2
  $ hg debugdrawdag << 'EOF'
  > D       G
  > |\     /|
  > B C   E F
  >  \|   |/
  >   \ H /
  >    \|/
  >     A
  > EOF

  $ hg rebase --collapse -d H -s 'B+F'
  abort: unable to collapse on top of 5, there is more than one external parent: 1, 3
  [255]
  $ cd ..
Adrian Buehlmann's avatar
Adrian Buehlmann committed
409

410
With internal merge:
Adrian Buehlmann's avatar
Adrian Buehlmann committed
411

412 413
  $ hg init internal-merge
  $ cd internal-merge
Adrian Buehlmann's avatar
Adrian Buehlmann committed
414

415 416 417 418 419 420 421 422 423
  $ hg debugdrawdag << 'EOF'
  >   E
  >   |\
  >   C D
  >   |/
  > F B
  > |/
  > A
  > EOF
Adrian Buehlmann's avatar
Adrian Buehlmann committed
424 425


426
  $ hg rebase -s B --collapse --dest F
427 428 429 430
  rebasing 1:112478962961 B "B"
  rebasing 3:26805aba1e60 C "C"
  rebasing 4:be0ef73c17ad D "D"
  rebasing 5:02c4367d6973 E tip "E"
431
  saved backup bundle to $TESTTMP/internal-merge/.hg/strip-backup/112478962961-1dfb057b-rebase.hg
Adrian Buehlmann's avatar
Adrian Buehlmann committed
432 433

  $ hg tglog
434
  o  2: c0512a1797b0 'Collapsed revision
Adrian Buehlmann's avatar
Adrian Buehlmann committed
435 436 437 438
  |  * B
  |  * C
  |  * D
  |  * E'
439
  o  1: 8908a377a434 'F'
Adrian Buehlmann's avatar
Adrian Buehlmann committed
440
  |
441
  o  0: 426bada5c675 'A'
Adrian Buehlmann's avatar
Adrian Buehlmann committed
442
  
443
  $ hg manifest --rev tip
Adrian Buehlmann's avatar
Adrian Buehlmann committed
444 445 446 447 448
  A
  B
  C
  D
  F
449
  $ cd ..
Adrian Buehlmann's avatar
Adrian Buehlmann committed
450

451 452 453 454 455 456 457
Interactions between collapse and keepbranches
  $ hg init e
  $ cd e
  $ echo 'a' > a
  $ hg ci -Am 'A'
  adding a

458 459
  $ hg branch 'one'
  marked working directory as branch one
Matt Mackall's avatar
Matt Mackall committed
460
  (branches are permanent and global, did you want a bookmark?)
461 462 463 464
  $ echo 'b' > b
  $ hg ci -Am 'B'
  adding b

465 466
  $ hg branch 'two'
  marked working directory as branch two
467 468 469 470 471 472 473 474 475 476
  $ echo 'c' > c
  $ hg ci -Am 'C'
  adding c

  $ hg up -q 0
  $ echo 'd' > d
  $ hg ci -Am 'D'
  adding d

  $ hg tglog
477
  @  3: 41acb9dca9eb 'D'
478
  |
479
  | o  2: 8ac4a08debf1 'C' two
480
  | |
481
  | o  1: 1ba175478953 'B' one
482
  |/
483
  o  0: 1994f17a630e 'A'
484 485 486 487 488
  
  $ hg rebase --keepbranches --collapse -s 1 -d 3
  abort: cannot collapse multiple named branches
  [255]

489 490 491 492 493 494 495 496 497 498 499
  $ cd ..

Rebase, collapse and copies

  $ hg init copies
  $ cd copies
  $ hg unbundle "$TESTDIR/bundles/renames.hg"
  adding changesets
  adding manifests
  adding file changes
  added 4 changesets with 11 changes to 7 files (+1 heads)
500
  new changesets f447d5abf5ea:338e84e2e558 (4 drafts)
501 502 503
  (run 'hg heads' to see heads, 'hg merge' to merge)
  $ hg up -q tip
  $ hg tglog
504
  @  3: 338e84e2e558 'move2'
505
  |
506
  o  2: 6e7340ee38c0 'move1'
507
  |
508
  | o  1: 1352765a01d4 'change'
509
  |/
510
  o  0: f447d5abf5ea 'add'
511 512
  
  $ hg rebase --collapse -d 1
513
  rebasing 2:6e7340ee38c0 "move1"
514 515 516
  merging a and d to d
  merging b and e to e
  merging c and f to f
517
  rebasing 3:338e84e2e558 tip "move2"
518
  merging f and c to c
519
  merging e and g to g
520
  saved backup bundle to $TESTTMP/copies/.hg/strip-backup/6e7340ee38c0-ef8ef003-rebase.hg
521
  $ hg st
522
  $ hg st --copies --change tip
523 524 525 526 527
  A d
    a
  A g
    b
  R b
528
  $ hg up tip -q
529 530 531 532 533 534 535 536 537 538 539
  $ cat c
  c
  c
  $ cat d
  a
  a
  $ cat g
  b
  b
  $ hg log -r . --template "{file_copies}\n"
  d (a)g (b)
540 541 542 543

Test collapsing a middle revision in-place

  $ hg tglog
544
  @  2: 64b456429f67 'Collapsed revision
545 546
  |  * move1
  |  * move2'
547
  o  1: 1352765a01d4 'change'
548
  |
549
  o  0: f447d5abf5ea 'add'
550 551
  
  $ hg rebase --collapse -r 1 -d 0
552
  abort: cannot rebase changeset with children
553
  (use --keep to keep original changesets)
554
  [10]
555 556 557 558

Test collapsing in place

  $ hg rebase --collapse -b . -d 0
559
  rebasing 1:1352765a01d4 "change"
560
  rebasing 2:64b456429f67 tip "Collapsed revision"
561
  saved backup bundle to $TESTTMP/copies/.hg/strip-backup/1352765a01d4-45a352ea-rebase.hg
562
  $ hg st --change tip --copies
563 564 565 566 567 568 569
  M a
  M c
  A d
    a
  A g
    b
  R b
570
  $ hg up tip -q
571 572 573 574 575 576 577 578 579 580 581 582
  $ cat a
  a
  a
  $ cat c
  c
  c
  $ cat d
  a
  a
  $ cat g
  b
  b
583
  $ cd ..
584 585 586 587 588 589 590


Test stripping a revision with another child

  $ hg init f
  $ cd f

591 592 593 594 595
  $ hg debugdrawdag << 'EOF'
  > C B
  > |/
  > A
  > EOF
596 597

  $ hg heads --template="{rev}:{node} {branch}: {desc}\n"
598 599
  2:dc0947a82db884575bb76ea10ac97b08536bfa03 default: C
  1:112478962961147124edd43549aedd1a335e44bf default: B
600

601 602
  $ hg strip C
  saved backup bundle to $TESTTMP/f/.hg/strip-backup/dc0947a82db8-d21b92a4-backup.hg
603 604

  $ hg tglog
605
  o  1: 112478962961 'B'
606
  |
607
  o  0: 426bada5c675 'A'
608 609 610 611
  


  $ hg heads --template="{rev}:{node} {branch}: {desc}\n"
612
  1:112478962961147124edd43549aedd1a335e44bf default: B
613 614 615

  $ cd ..

616
Test collapsing changes that add then remove a file
617

618 619
  $ hg init collapseaddremove
  $ cd collapseaddremove
620

621 622 623 624 625 626 627 628 629 630
  $ touch base
  $ hg commit -Am base
  adding base
  $ touch a
  $ hg commit -Am a
  adding a
  $ hg rm a
  $ touch b
  $ hg commit -Am b
  adding b
631
  $ hg book foo
632
  $ hg rebase -d 0 -r "1::2" --collapse -m collapsed
633
  rebasing 1:6d8d9f24eec3 "a"
634
  rebasing 2:1cc73eca5ecc foo tip "b"
635
  saved backup bundle to $TESTTMP/collapseaddremove/.hg/strip-backup/6d8d9f24eec3-77d3b6e2-rebase.hg
636 637
  $ hg log -G --template "{rev}: '{desc}' {bookmarks}"
  @  1: 'collapsed' foo
638
  |
639
  o  0: 'base'
640
  
641
  $ hg manifest --rev tip
642 643
  b
  base
644

645
  $ cd ..
646 647 648 649 650 651

Test that rebase --collapse will remember message after
running into merge conflict and invoking rebase --continue.

  $ hg init collapse_remember_message
  $ cd collapse_remember_message
652 653 654 655 656 657
  $ hg debugdrawdag << 'EOF'
  > C B # B/A = B\n
  > |/  # C/A = C\n
  > A
  > EOF
  $ hg rebase --collapse -m "new message" -b B -d C
658
  rebasing 1:81e5401e4d37 B "B"
659 660
  merging A
  warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
661
  unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
662
  [240]
663 664
  $ rm A.orig
  $ hg resolve --mark A
665 666 667
  (no more unresolved files)
  continue: hg rebase --continue
  $ hg rebase --continue
668
  rebasing 1:81e5401e4d37 B "B"
669
  saved backup bundle to $TESTTMP/collapse_remember_message/.hg/strip-backup/81e5401e4d37-96c3dd30-rebase.hg
670
  $ hg log
671
  changeset:   2:17186933e123
672 673 674
  tag:         tip
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
675
  summary:     new message
676
  
677 678
  changeset:   1:043039e9df84
  tag:         C
679 680
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
681
  summary:     C
682
  
683 684
  changeset:   0:426bada5c675
  tag:         A
685 686
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
687
  summary:     A
688 689
  
  $ cd ..
690 691 692 693 694 695 696 697 698 699 700 701 702 703 704

Test aborted editor on final message

  $ HGMERGE=:merge3
  $ export HGMERGE
  $ hg init aborted-editor
  $ cd aborted-editor
  $ hg debugdrawdag << 'EOF'
  > C   # D/A = D\n
  > |   # C/A = C\n
  > B D # B/A = B\n
  > |/  # A/A = A\n
  > A
  > EOF
  $ hg rebase --collapse -t internal:merge3 -s B -d D
705
  rebasing 1:f899f3910ce7 B "B"
706 707
  merging A
  warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
708
  unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
709
  [240]
710 711 712 713 714
  $ hg tglog
  o  3: 63668d570d21 'C'
  |
  | @  2: 82b8abf9c185 'D'
  | |
715
  % |  1: f899f3910ce7 'B'
716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731
  |/
  o  0: 4a2df7238c3b 'A'
  
  $ cat A
  <<<<<<< dest:   82b8abf9c185 D - test: D
  D
  ||||||| base
  A
  =======
  B
  >>>>>>> source: f899f3910ce7 B - test: B
  $ echo BC > A
  $ hg resolve -m
  (no more unresolved files)
  continue: hg rebase --continue
  $ hg rebase --continue
732 733
  rebasing 1:f899f3910ce7 B "B"
  rebasing 3:63668d570d21 C tip "C"
734 735
  merging A
  warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
736
  unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
737
  [240]
738
  $ hg tglog
739
  %  3: 63668d570d21 'C'
740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759
  |
  | @  2: 82b8abf9c185 'D'
  | |
  o |  1: f899f3910ce7 'B'
  |/
  o  0: 4a2df7238c3b 'A'
  
  $ cat A
  <<<<<<< dest:   82b8abf9c185 D - test: D
  BC
  ||||||| base
  B
  =======
  C
  >>>>>>> source: 63668d570d21 C tip - test: C
  $ echo BD > A
  $ hg resolve -m
  (no more unresolved files)
  continue: hg rebase --continue
  $ HGEDITOR=false hg rebase --continue --config ui.interactive=1
760 761
  already rebased 1:f899f3910ce7 B "B" as 82b8abf9c185
  rebasing 3:63668d570d21 C tip "C"
762
  abort: edit failed: false exited with status 1
763
  [250]
764
  $ hg tglog
765
  o  3: 63668d570d21 'C'
766 767 768 769 770 771 772 773
  |
  | @  2: 82b8abf9c185 'D'
  | |
  o |  1: f899f3910ce7 'B'
  |/
  o  0: 4a2df7238c3b 'A'
  
  $ hg rebase --continue
774 775
  already rebased 1:f899f3910ce7 B "B" as 82b8abf9c185
  already rebased 3:63668d570d21 C tip "C" as 82b8abf9c185
776
  saved backup bundle to $TESTTMP/aborted-editor/.hg/strip-backup/f899f3910ce7-7cab5e15-rebase.hg