comparison tests/test-evolve-content-divergence.t @ 3806:99469bb3854e

tests: add tests for resolving content-divergence when different parents This patch adds more tests for cases when we try to resolve content-divergence when they are on different parents. The last test shows the we are somehow missing the relocated commit in interrupted transaction. This will be fixed in next patch.
author Pulkit Goyal <7895pulkit@gmail.com>
date Thu, 07 Jun 2018 15:54:32 +0530
parents 2410e7063692
children 03ccdc753582
comparison
equal deleted inserted replaced
3805:2410e7063692 3806:99469bb3854e
281 () [default] draft 281 () [default] draft
282 282
283 $ cd .. 283 $ cd ..
284 284
285 Testing resolution of content-divergent changesets when they are on different 285 Testing resolution of content-divergent changesets when they are on different
286 parents 286 parents and resolution and relocation wont result in conflicts
287 ------------------------------------------------------------------------------ 287 ------------------------------------------------------------------------------
288 288
289 $ hg init multiparents 289 $ hg init multiparents
290 $ cd multiparents 290 $ cd multiparents
291 $ echo ".*\.orig" > .hgignore 291 $ echo ".*\.orig" > .hgignore
367 diff -r c7586e2a9264 -r 7ed0642d644b b 367 diff -r c7586e2a9264 -r 7ed0642d644b b
368 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 368 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
369 +++ b/b Thu Jan 01 00:00:00 1970 +0000 369 +++ b/b Thu Jan 01 00:00:00 1970 +0000
370 @@ -0,0 +1,1 @@ 370 @@ -0,0 +1,1 @@
371 +bar 371 +bar
372
373 Resolving orphans to get back to a normal graph
374
375 $ hg evolve --all
376 move:[3] added c
377 atop:[5] added b
378 move:[4] added d
379 atop:[8] added c
380 working directory is now at b6b20b8eefdc
381 $ hg glog
382 @ 9:b6b20b8eefdc added d
383 | () [default] draft
384 o 8:7c46f743e62f added c
385 | () [default] draft
386 o 5:7ed0642d644b added b
387 | () [default] draft
388 o 1:c7586e2a9264 added a
389 | () [default] draft
390 o 0:8fa14d15e168 added hgignore
391 () [default] draft
392
393 More testing!
394
395 $ hg up .^^
396 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
397 $ echo x > x
398 $ hg ci -Aqm "added x"
399 $ hg glog -r .
400 @ 10:cfae5f87cd34 added x
401 | () [default] draft
402 ~
403
404 $ echo foo > x
405 $ hg branch bar
406 marked working directory as branch bar
407 (branches are permanent and global, did you want a bookmark?)
408 $ hg amend -m "added foo to x"
409
410 $ hg up cfae5f87cd34 --hidden
411 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
412 updated to hidden changeset cfae5f87cd34
413 (hidden revision 'cfae5f87cd34' was rewritten as: 580d9d182d90)
414 working directory parent is obsolete! (cfae5f87cd34)
415 (use 'hg evolve' to update to its successor: 580d9d182d90)
416 $ hg rebase -r . -d b6b20b8eefdc --config experimental.evolution.allowdivergence=True
417 rebasing 10:cfae5f87cd34 "added x"
418 2 new content-divergent changesets
419
420 $ hg glog
421 @ 12:c4d1990428e3 added x
422 | () [default] draft
423 | * 11:580d9d182d90 added foo to x
424 | | () [bar] draft
425 o | 9:b6b20b8eefdc added d
426 | | () [default] draft
427 o | 8:7c46f743e62f added c
428 |/ () [default] draft
429 o 5:7ed0642d644b added b
430 | () [default] draft
431 o 1:c7586e2a9264 added a
432 | () [default] draft
433 o 0:8fa14d15e168 added hgignore
434 () [default] draft
435
436 $ hg evolve --content-divergent
437 merge:[12] added x
438 with: [11] added foo to x
439 base: [10] added x
440 rebasing "other" content-divergent changeset 580d9d182d90 on b6b20b8eefdc
441 updating to "local" side of the conflict: c4d1990428e3
442 merging "other" content-divergent changeset 'd3bfc0b3f350'
443 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
444 working directory is now at be41fdcd0ee1
445
446 $ hg exp
447 # HG changeset patch
448 # User test
449 # Date 0 0
450 # Thu Jan 01 00:00:00 1970 +0000
451 # Branch bar
452 # Node ID be41fdcd0ee181081c4e42c6ee333d3dc3b3ab45
453 # Parent b6b20b8eefdce1f32126c71d20bdb72a62b38268
454 added foo to x
455
456 diff -r b6b20b8eefdc -r be41fdcd0ee1 x
457 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
458 +++ b/x Thu Jan 01 00:00:00 1970 +0000
459 @@ -0,0 +1,1 @@
460 +foo
461
462 The above `hg exp` and the following log call demonstrates that message, content
463 and branch change is preserved in case of relocation
464 $ hg glog
465 @ 14:be41fdcd0ee1 added foo to x
466 | () [bar] draft
467 o 9:b6b20b8eefdc added d
468 | () [default] draft
469 o 8:7c46f743e62f added c
470 | () [default] draft
471 o 5:7ed0642d644b added b
472 | () [default] draft
473 o 1:c7586e2a9264 added a
474 | () [default] draft
475 o 0:8fa14d15e168 added hgignore
476 () [default] draft
477
478 Testing when both the content-divergence are on different parents and resolution
479 will lead to conflicts
480 ---------------------------------------------------------------------------------
481
482 $ hg up .^^^
483 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
484
485 $ echo y > y
486 $ hg ci -Aqm "added y"
487 $ hg glog -r .
488 @ 15:9c30046901ab added y
489 | () [default] draft
490 ~
491
492 $ echo bar > y
493 $ hg amend
494
495 $ hg up 9c30046901ab --hidden
496 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
497 updated to hidden changeset 9c30046901ab
498 (hidden revision '9c30046901ab' was rewritten as: 29e08829c51f)
499 working directory parent is obsolete! (9c30046901ab)
500 (use 'hg evolve' to update to its successor: 29e08829c51f)
501 $ hg rebase -r . -d be41fdcd0ee1 --config experimental.evolution.allowdivergence=True
502 rebasing 15:9c30046901ab "added y"
503 2 new content-divergent changesets
504 $ echo wat > y
505 $ hg amend
506
507 $ hg glog
508 @ 18:4065e1d314c3 added y
509 | () [bar] draft
510 | * 16:29e08829c51f added y
511 | | () [default] draft
512 o | 14:be41fdcd0ee1 added foo to x
513 | | () [bar] draft
514 o | 9:b6b20b8eefdc added d
515 | | () [default] draft
516 o | 8:7c46f743e62f added c
517 |/ () [default] draft
518 o 5:7ed0642d644b added b
519 | () [default] draft
520 o 1:c7586e2a9264 added a
521 | () [default] draft
522 o 0:8fa14d15e168 added hgignore
523 () [default] draft
524
525 $ hg evolve --content-divergent
526 merge:[18] added y
527 with: [16] added y
528 base: [15] added y
529 rebasing "other" content-divergent changeset 29e08829c51f on be41fdcd0ee1
530 updating to "local" side of the conflict: 4065e1d314c3
531 merging "other" content-divergent changeset '6d515d1ffc69'
532 merging y
533 warning: conflicts while merging y! (edit, then use 'hg resolve --mark')
534 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
535 transaction abort!
536 rollback completed
537 abort: fix conflicts and run 'hg evolve --continue' or use 'hg update -C .' to abort
538 [255]
539
540 $ echo watbar > y
541 $ hg resolve -m
542 (no more unresolved files)
543 continue: hg evolve --continue
544 $ hg evolve --continue
545 working directory is now at bbaca013758a
546
547 $ hg glog
548 @ 19:bbaca013758a added y
549 | () [bar] draft
550 o 14:be41fdcd0ee1 added foo to x
551 | () [bar] draft
552 o 9:b6b20b8eefdc added d
553 | () [default] draft
554 o 8:7c46f743e62f added c
555 | () [default] draft
556 o 5:7ed0642d644b added b
557 | () [default] draft
558 o 1:c7586e2a9264 added a
559 | () [default] draft
560 o 0:8fa14d15e168 added hgignore
561 () [default] draft
562
563 checking that relocated commit is there
564 $ hg exp 6d515d1ffc69 --hidden
565 abort: unknown revision '6d515d1ffc69'!
566 [255]