comparison tests/test-resolve.t @ 41281:183df3df6031

resolve: fix mark-check when a file was deleted on one side (issue6020) wvfs.open raises an error if one of the files does not exist. Ignoring the error if it's ENOENT is done in several other places in this code, so I'm in good company :) Differential Revision: https://phab.mercurial-scm.org/D5243
author Kyle Lippincott <spectral@google.com>
date Wed, 07 Nov 2018 15:45:09 -0800
parents db61a18148a4
children 72a9aacff645
comparison
equal deleted inserted replaced
41280:f4277a35c42c 41281:183df3df6031
627 $ hg rebase --abort 627 $ hg rebase --abort
628 rebase aborted 628 rebase aborted
629 629
630 Done with commands.resolve.confirm tests: 630 Done with commands.resolve.confirm tests:
631 $ cd .. 631 $ cd ..
632
633 Test that commands.resolve.mark-check works even if there are deleted files:
634 $ hg init resolve-deleted
635 $ cd resolve-deleted
636 $ echo r0 > file1
637 $ hg ci -qAm r0
638 $ echo r1 > file1
639 $ hg ci -qm r1
640 $ hg co -qr 0
641 $ hg rm file1
642 $ hg ci -qm "r2 (delete file1)"
643
644 (At this point we have r0 creating file1, and sibling commits r1 and r2, which
645 modify and delete file1, respectively)
646
647 $ hg merge -r 1
648 file 'file1' was deleted in local [working copy] but was modified in other [merge rev].
649 What do you want to do?
650 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
651 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
652 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
653 [1]
654 $ hg resolve --list
655 U file1
656 Because we left it as 'unresolved' the file should still exist.
657 $ [ -f file1 ] || echo "File does not exist?"
658 BC behavior: `hg resolve --mark` accepts that the file is still there, and
659 doesn't have a problem with this situation.
660 $ hg resolve --mark --config commands.resolve.mark-check=abort
661 (no more unresolved files)
662 $ hg resolve --list
663 R file1
664 The file is still there:
665 $ [ -f file1 ] || echo "File does not exist?"
666 Let's check mark-check=warn:
667 $ hg resolve --unmark file1
668 $ hg resolve --mark --config commands.resolve.mark-check=warn
669 (no more unresolved files)
670 $ hg resolve --list
671 R file1
672 The file is still there:
673 $ [ -f file1 ] || echo "File does not exist?"
674 Let's resolve the issue by deleting the file via `hg resolve`
675 $ hg resolve --unmark file1
676 $ echo 'd' | hg resolve file1 --config ui.interactive=1
677 file 'file1' was deleted in local [working copy] but was modified in other [merge rev].
678 What do you want to do?
679 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? d
680 (no more unresolved files)
681 $ hg resolve --list
682 R file1
683 The file is deleted:
684 $ [ -f file1 ] && echo "File still exists?" || true
685 Doing `hg resolve --mark` doesn't break now that the file is missing:
686 $ hg resolve --mark --config commands.resolve.mark-check=abort
687 (no more unresolved files)
688 $ hg resolve --mark --config commands.resolve.mark-check=warn
689 (no more unresolved files)
690 Resurrect the file, and delete it outside of hg:
691 $ hg resolve --unmark file1
692 $ hg resolve file1
693 file 'file1' was deleted in local [working copy] but was modified in other [merge rev].
694 What do you want to do?
695 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
696 [1]
697 $ [ -f file1 ] || echo "File does not exist?"
698 $ hg resolve --list
699 U file1
700 $ rm file1
701 $ hg resolve --mark --config commands.resolve.mark-check=abort
702 (no more unresolved files)
703 $ hg resolve --list
704 R file1
705 $ hg resolve --unmark file1
706 $ hg resolve file1
707 file 'file1' was deleted in local [working copy] but was modified in other [merge rev].
708 What do you want to do?
709 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
710 [1]
711 $ [ -f file1 ] || echo "File does not exist?"
712 $ hg resolve --list
713 U file1
714 $ rm file1
715 $ hg resolve --mark --config commands.resolve.mark-check=warn
716 (no more unresolved files)
717 $ hg resolve --list
718 R file1
719
720
721 For completeness, let's try that in the opposite direction (merging r2 into r1,
722 instead of r1 into r2):
723 $ hg update -qCr 1
724 $ hg merge -r 2
725 file 'file1' was deleted in other [merge rev] but was modified in local [working copy].
726 What do you want to do?
727 use (c)hanged version, (d)elete, or leave (u)nresolved? u
728 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
729 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
730 [1]
731 $ hg resolve --list
732 U file1
733 Because we left it as 'unresolved' the file should still exist.
734 $ [ -f file1 ] || echo "File does not exist?"
735 BC behavior: `hg resolve --mark` accepts that the file is still there, and
736 doesn't have a problem with this situation.
737 $ hg resolve --mark --config commands.resolve.mark-check=abort
738 (no more unresolved files)
739 $ hg resolve --list
740 R file1
741 The file is still there:
742 $ [ -f file1 ] || echo "File does not exist?"
743 Let's check mark-check=warn:
744 $ hg resolve --unmark file1
745 $ hg resolve --mark --config commands.resolve.mark-check=warn
746 (no more unresolved files)
747 $ hg resolve --list
748 R file1
749 The file is still there:
750 $ [ -f file1 ] || echo "File does not exist?"
751 Let's resolve the issue by deleting the file via `hg resolve`
752 $ hg resolve --unmark file1
753 $ echo 'd' | hg resolve file1 --config ui.interactive=1
754 file 'file1' was deleted in other [merge rev] but was modified in local [working copy].
755 What do you want to do?
756 use (c)hanged version, (d)elete, or leave (u)nresolved? d
757 (no more unresolved files)
758 $ hg resolve --list
759 R file1
760 The file is deleted:
761 $ [ -f file1 ] && echo "File still exists?" || true
762 Doing `hg resolve --mark` doesn't break now that the file is missing:
763 $ hg resolve --mark --config commands.resolve.mark-check=abort
764 (no more unresolved files)
765 $ hg resolve --mark --config commands.resolve.mark-check=warn
766 (no more unresolved files)
767 Resurrect the file, and delete it outside of hg:
768 $ hg resolve --unmark file1
769 $ hg resolve file1
770 file 'file1' was deleted in other [merge rev] but was modified in local [working copy].
771 What do you want to do?
772 use (c)hanged version, (d)elete, or leave (u)nresolved? u
773 [1]
774 $ [ -f file1 ] || echo "File does not exist?"
775 $ hg resolve --list
776 U file1
777 $ rm file1
778 $ hg resolve --mark --config commands.resolve.mark-check=abort
779 (no more unresolved files)
780 $ hg resolve --list
781 R file1
782 $ hg resolve --unmark file1
783 $ hg resolve file1
784 file 'file1' was deleted in other [merge rev] but was modified in local [working copy].
785 What do you want to do?
786 use (c)hanged version, (d)elete, or leave (u)nresolved? u
787 [1]
788 $ [ -f file1 ] || echo "File does not exist?"
789 $ hg resolve --list
790 U file1
791 $ rm file1
792 $ hg resolve --mark --config commands.resolve.mark-check=warn
793 (no more unresolved files)
794 $ hg resolve --list
795 R file1
796
797 $ cd ..