Mercurial > hg
comparison tests/test-rebase-inmemory.t @ 38667:572dff5c946e
rebase: add --confirm option
This feature adds a functionality in rebase to confirm before applying
changes.
When there is no conflict and user confirm to apply actions, we just
finish the unfinished rebase. But when there is a conflict and user
confirm to apply actions then we can't just finish rebasing using
rbsrt._finishrebase() because in-memory merge doesn't support conflicts, so
we have to abort and run on-disk merge in this case.
And if user doesn't confirm to apply actions then simply abort the rebase.
Differential Revision: https://phab.mercurial-scm.org/D3870
author | Sushil khanchi <sushilkhanchi97@gmail.com> |
---|---|
date | Sat, 30 Jun 2018 12:42:49 +0530 |
parents | 731debab233f |
children | 35b3f686157a |
comparison
equal
deleted
inserted
replaced
38666:a06b2b032557 | 38667:572dff5c946e |
---|---|
2 $ cat << EOF >> $HGRCPATH | 2 $ cat << EOF >> $HGRCPATH |
3 > [extensions] | 3 > [extensions] |
4 > amend= | 4 > amend= |
5 > rebase= | 5 > rebase= |
6 > debugdrawdag=$TESTDIR/drawdag.py | 6 > debugdrawdag=$TESTDIR/drawdag.py |
7 > strip= | |
7 > [rebase] | 8 > [rebase] |
8 > experimental.inmemory=1 | 9 > experimental.inmemory=1 |
9 > [diff] | 10 > [diff] |
10 > git=1 | 11 > git=1 |
11 > [alias] | 12 > [alias] |
154 | o 1: fc055c3b4d33 'b' | 155 | o 1: fc055c3b4d33 'b' |
155 |/ | 156 |/ |
156 o 0: b173517d0057 'a' | 157 o 0: b173517d0057 'a' |
157 | 158 |
158 Test dry-run rebasing | 159 Test dry-run rebasing |
159 $ hg init skrepo | 160 $ hg init repo3 |
160 $ cd skrepo | 161 $ cd repo3 |
161 $ echo a>a | 162 $ echo a>a |
162 $ hg ci -Aqma | 163 $ hg ci -Aqma |
163 $ echo b>b | 164 $ echo b>b |
164 $ hg ci -Aqmb | 165 $ hg ci -Aqmb |
165 $ echo c>c | 166 $ echo c>c |
321 rebasing 3:055a42cdd887 "d" | 322 rebasing 3:055a42cdd887 "d" |
322 rebasing 4:e860deea161a "e" | 323 rebasing 4:e860deea161a "e" |
323 merging e | 324 merging e |
324 hit a merge conflict | 325 hit a merge conflict |
325 [1] | 326 [1] |
327 | |
328 ========================== | |
329 Test for --confirm option| | |
330 ========================== | |
331 $ cd .. | |
332 $ hg clone repo3 repo4 -q | |
333 $ cd repo4 | |
334 $ hg strip 7 -q | |
335 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n" | |
336 @ 6:baf10c5166d4 test | |
337 | g | |
338 | | |
339 o 5:6343ca3eff20 test | |
340 | f | |
341 | | |
342 | o 4:e860deea161a test | |
343 | | e | |
344 | | | |
345 | o 3:055a42cdd887 test | |
346 | | d | |
347 | | | |
348 | o 2:177f92b77385 test | |
349 |/ c | |
350 | | |
351 o 1:d2ae7f538514 test | |
352 | b | |
353 | | |
354 o 0:cb9a9f314b8b test | |
355 a | |
356 | |
357 Check it gives error when both --dryrun and --confirm is used: | |
358 $ hg rebase -s 2 -d . --confirm --dry-run | |
359 abort: cannot specify both --confirm and --dry-run | |
360 [255] | |
361 $ hg rebase -s 2 -d . --confirm --abort | |
362 abort: cannot specify both --confirm and --abort | |
363 [255] | |
364 $ hg rebase -s 2 -d . --confirm --continue | |
365 abort: cannot specify both --confirm and --continue | |
366 [255] | |
367 | |
368 Test --confirm option when there are no conflicts: | |
369 $ hg rebase -s 2 -d . --keep --config ui.interactive=True --confirm << EOF | |
370 > n | |
371 > EOF | |
372 starting rebase... | |
373 rebasing 2:177f92b77385 "c" | |
374 rebasing 3:055a42cdd887 "d" | |
375 rebasing 4:e860deea161a "e" | |
376 rebase completed successfully | |
377 apply changes (yn)? n | |
378 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n" | |
379 @ 6:baf10c5166d4 test | |
380 | g | |
381 | | |
382 o 5:6343ca3eff20 test | |
383 | f | |
384 | | |
385 | o 4:e860deea161a test | |
386 | | e | |
387 | | | |
388 | o 3:055a42cdd887 test | |
389 | | d | |
390 | | | |
391 | o 2:177f92b77385 test | |
392 |/ c | |
393 | | |
394 o 1:d2ae7f538514 test | |
395 | b | |
396 | | |
397 o 0:cb9a9f314b8b test | |
398 a | |
399 | |
400 $ hg rebase -s 2 -d . --keep --config ui.interactive=True --confirm << EOF | |
401 > y | |
402 > EOF | |
403 starting rebase... | |
404 rebasing 2:177f92b77385 "c" | |
405 rebasing 3:055a42cdd887 "d" | |
406 rebasing 4:e860deea161a "e" | |
407 rebase completed successfully | |
408 apply changes (yn)? y | |
409 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n" | |
410 o 9:9fd28f55f6dc test | |
411 | e | |
412 | | |
413 o 8:12cbf031f469 test | |
414 | d | |
415 | | |
416 o 7:c83b1da5b1ae test | |
417 | c | |
418 | | |
419 @ 6:baf10c5166d4 test | |
420 | g | |
421 | | |
422 o 5:6343ca3eff20 test | |
423 | f | |
424 | | |
425 | o 4:e860deea161a test | |
426 | | e | |
427 | | | |
428 | o 3:055a42cdd887 test | |
429 | | d | |
430 | | | |
431 | o 2:177f92b77385 test | |
432 |/ c | |
433 | | |
434 o 1:d2ae7f538514 test | |
435 | b | |
436 | | |
437 o 0:cb9a9f314b8b test | |
438 a | |
439 | |
440 Test --confirm option when there is a conflict | |
441 $ hg up tip -q | |
442 $ echo ee>e | |
443 $ hg ci --amend -m "conflict with e" -q | |
444 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n" | |
445 @ 9:906d72f66a59 test | |
446 | conflict with e | |
447 | | |
448 o 8:12cbf031f469 test | |
449 | d | |
450 | | |
451 o 7:c83b1da5b1ae test | |
452 | c | |
453 | | |
454 o 6:baf10c5166d4 test | |
455 | g | |
456 | | |
457 o 5:6343ca3eff20 test | |
458 | f | |
459 | | |
460 | o 4:e860deea161a test | |
461 | | e | |
462 | | | |
463 | o 3:055a42cdd887 test | |
464 | | d | |
465 | | | |
466 | o 2:177f92b77385 test | |
467 |/ c | |
468 | | |
469 o 1:d2ae7f538514 test | |
470 | b | |
471 | | |
472 o 0:cb9a9f314b8b test | |
473 a | |
474 | |
475 $ hg rebase -s 4 -d . --keep --config ui.interactive=True --confirm << EOF | |
476 > n | |
477 > EOF | |
478 starting rebase... | |
479 rebasing 4:e860deea161a "e" | |
480 merging e | |
481 hit a merge conflict | |
482 apply changes (yn)? n | |
483 [1] | |
484 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n" | |
485 @ 9:906d72f66a59 test | |
486 | conflict with e | |
487 | | |
488 o 8:12cbf031f469 test | |
489 | d | |
490 | | |
491 o 7:c83b1da5b1ae test | |
492 | c | |
493 | | |
494 o 6:baf10c5166d4 test | |
495 | g | |
496 | | |
497 o 5:6343ca3eff20 test | |
498 | f | |
499 | | |
500 | o 4:e860deea161a test | |
501 | | e | |
502 | | | |
503 | o 3:055a42cdd887 test | |
504 | | d | |
505 | | | |
506 | o 2:177f92b77385 test | |
507 |/ c | |
508 | | |
509 o 1:d2ae7f538514 test | |
510 | b | |
511 | | |
512 o 0:cb9a9f314b8b test | |
513 a | |
514 | |
515 | |
516 $ hg rebase -s 4 -d . --keep --config ui.interactive=True --confirm << EOF | |
517 > y | |
518 > EOF | |
519 starting rebase... | |
520 rebasing 4:e860deea161a "e" | |
521 merging e | |
522 hit a merge conflict | |
523 apply changes (yn)? y | |
524 rebasing 4:e860deea161a "e" | |
525 merging e | |
526 warning: conflicts while merging e! (edit, then use 'hg resolve --mark') | |
527 unresolved conflicts (see hg resolve, then hg rebase --continue) | |
528 [1] | |
529 | |
530 $ echo e>e | |
531 $ hg resolve --mark --all | |
532 (no more unresolved files) | |
533 continue: hg rebase --continue | |
534 $ hg rebase --continue | |
535 rebasing 4:e860deea161a "e" | |
536 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n" | |
537 o 10:9fa3731dd6df test | |
538 | e | |
539 | | |
540 @ 9:906d72f66a59 test | |
541 | conflict with e | |
542 | | |
543 o 8:12cbf031f469 test | |
544 | d | |
545 | | |
546 o 7:c83b1da5b1ae test | |
547 | c | |
548 | | |
549 o 6:baf10c5166d4 test | |
550 | g | |
551 | | |
552 o 5:6343ca3eff20 test | |
553 | f | |
554 | | |
555 | o 4:e860deea161a test | |
556 | | e | |
557 | | | |
558 | o 3:055a42cdd887 test | |
559 | | d | |
560 | | | |
561 | o 2:177f92b77385 test | |
562 |/ c | |
563 | | |
564 o 1:d2ae7f538514 test | |
565 | b | |
566 | | |
567 o 0:cb9a9f314b8b test | |
568 a | |
569 |