comparison tests/test-graft.t @ 44091:3df0bd706c40

graftcopies: use _filter() for filtering out invalid copies `graftcopies()` (formerly called `duplicatecopies()`) checked that the copy destination existed in the working copy, but it didn't check that copy source existed in the parent of the working copy. In `test-graft.t` we can see that as warnings about not finding ancestors of the copied files, and also empty commits getting created. This patch uses the existing `_filter()` function for filtering out invalid copies. In addition to the aforementioned types, that also includes copies where source and destination is the same. Differential Revision: https://phab.mercurial-scm.org/D7859
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 27 Dec 2019 15:14:19 -0800
parents f3ad014b6a53
children 17e12938f8e7
comparison
equal deleted inserted replaced
44090:2f0a44c69e07 44091:3df0bd706c40
491 Graft with --log 491 Graft with --log
492 492
493 $ hg up -Cq 1 493 $ hg up -Cq 1
494 $ hg graft 3 --log -u foo 494 $ hg graft 3 --log -u foo
495 grafting 3:4c60f11aa304 "3" 495 grafting 3:4c60f11aa304 "3"
496 warning: can't find ancestor for 'c' copied from 'b'!
497 $ hg log --template '{rev}:{node|short} {parents} {desc}\n' -r tip 496 $ hg log --template '{rev}:{node|short} {parents} {desc}\n' -r tip
498 14:0c921c65ef1e 1:5d205f8b35b6 3 497 14:0c921c65ef1e 1:5d205f8b35b6 3
499 (grafted from 4c60f11aa304a54ae1c199feb94e7fc771e51ed8) 498 (grafted from 4c60f11aa304a54ae1c199feb94e7fc771e51ed8)
500 499
501 Resolve conflicted graft 500 Resolve conflicted graft
751 checking for directory renames 750 checking for directory renames
752 resolving manifests 751 resolving manifests
753 branchmerge: True, force: True, partial: False 752 branchmerge: True, force: True, partial: False
754 ancestor: b592ea63bb0c, local: 7e61b508e709+, remote: 7a4785234d87 753 ancestor: b592ea63bb0c, local: 7e61b508e709+, remote: 7a4785234d87
755 starting 4 threads for background file closing (?) 754 starting 4 threads for background file closing (?)
756 committing files: 755 note: graft of 13:7a4785234d87 created no changes to commit
757 b
758 warning: can't find ancestor for 'b' copied from 'a'!
759 reusing manifest from p1 (listed files actually unchanged)
760 committing changelog
761 updating the branch cache
762 $ hg log -r 'destination(13)' 756 $ hg log -r 'destination(13)'
763 All copies of a cset 757 All copies of a cset
764 $ hg log -r 'origin(13) or destination(origin(13))' 758 $ hg log -r 'origin(13) or destination(origin(13))'
765 changeset: 2:5c095ad7e90f 759 changeset: 2:5c095ad7e90f
766 user: test 760 user: test
783 date: Thu Jan 01 00:00:00 1970 +0000 777 date: Thu Jan 01 00:00:00 1970 +0000
784 summary: 2 778 summary: 2
785 779
786 changeset: 21:7e61b508e709 780 changeset: 21:7e61b508e709
787 branch: dev 781 branch: dev
788 user: foo
789 date: Thu Jan 01 00:00:00 1970 +0000
790 summary: 2
791
792 changeset: 22:3a4e92d81b97
793 branch: dev
794 tag: tip 782 tag: tip
795 user: foo 783 user: foo
796 date: Thu Jan 01 00:00:00 1970 +0000 784 date: Thu Jan 01 00:00:00 1970 +0000
797 summary: 2 785 summary: 2
798 786
807 graft with --force (still doesn't graft merges) 795 graft with --force (still doesn't graft merges)
808 796
809 $ hg graft 19 0 6 797 $ hg graft 19 0 6
810 skipping ungraftable merge revision 6 798 skipping ungraftable merge revision 6
811 skipping ancestor revision 0:68795b066622 799 skipping ancestor revision 0:68795b066622
812 skipping already grafted revision 19:9627f653b421 (22:3a4e92d81b97 also has origin 2:5c095ad7e90f) 800 grafting 19:9627f653b421 "2"
813 [255] 801 merging b
802 note: graft of 19:9627f653b421 created no changes to commit
814 $ hg graft 19 0 6 --force 803 $ hg graft 19 0 6 --force
815 skipping ungraftable merge revision 6 804 skipping ungraftable merge revision 6
816 grafting 19:9627f653b421 "2" 805 grafting 19:9627f653b421 "2"
817 merging b 806 merging b
818 warning: can't find ancestor for 'b' copied from 'a'! 807 note: graft of 19:9627f653b421 created no changes to commit
819 grafting 0:68795b066622 "0" 808 grafting 0:68795b066622 "0"
820 809
821 graft --force after backout 810 graft --force after backout
822 811
823 $ echo abc > a 812 $ echo abc > a
824 $ hg ci -m 26 813 $ hg ci -m 24
825 $ hg backout 26 814 $ hg backout 24
826 reverting a 815 reverting a
827 changeset 27:e25e17192dc4 backs out changeset 26:44f862488a35 816 changeset 25:71c4e63d4f98 backs out changeset 24:2e7ea477be26
828 $ hg graft 26 817 $ hg graft 24
829 skipping ancestor revision 26:44f862488a35 818 skipping ancestor revision 24:2e7ea477be26
830 [255] 819 [255]
831 $ hg graft 26 --force 820 $ hg graft 24 --force
832 grafting 26:44f862488a35 "26" 821 grafting 24:2e7ea477be26 "24"
833 merging a 822 merging a
834 $ cat a 823 $ cat a
835 abc 824 abc
836 825
837 graft --continue after --force 826 graft --continue after --force
838 827
839 $ echo def > a 828 $ echo def > a
840 $ hg ci -m 29 829 $ hg ci -m 27
841 $ hg graft 26 --force --tool internal:fail 830 $ hg graft 24 --force --tool internal:fail
842 grafting 26:44f862488a35 "26" 831 grafting 24:2e7ea477be26 "24"
843 abort: unresolved conflicts, can't continue 832 abort: unresolved conflicts, can't continue
844 (use 'hg resolve' and 'hg graft --continue') 833 (use 'hg resolve' and 'hg graft --continue')
845 [255] 834 [255]
846 $ hg resolve --all 835 $ hg resolve --all
847 merging a 836 merging a
850 $ echo abc > a 839 $ echo abc > a
851 $ hg resolve -m a 840 $ hg resolve -m a
852 (no more unresolved files) 841 (no more unresolved files)
853 continue: hg graft --continue 842 continue: hg graft --continue
854 $ hg graft -c 843 $ hg graft -c
855 grafting 26:44f862488a35 "26" 844 grafting 24:2e7ea477be26 "24"
856 $ cat a 845 $ cat a
857 abc 846 abc
858 847
859 Continue testing same origin policy, using revision numbers from test above 848 Continue testing same origin policy, using revision numbers from test above
860 but do some destructive editing of the repo: 849 but do some destructive editing of the repo:
867 skipping already grafted revision 8:7a4785234d87 (2:ef0ef43d49e7 also has unknown origin 5c095ad7e90f) 856 skipping already grafted revision 8:7a4785234d87 (2:ef0ef43d49e7 also has unknown origin 5c095ad7e90f)
868 [255] 857 [255]
869 858
870 Empty graft 859 Empty graft
871 860
872 $ hg up -qr 24 861 $ hg up -qr 22
873 $ hg tag -f something 862 $ hg tag -f something
874 $ hg graft -qr 25 863 $ hg graft -qr 23
875 $ hg graft -f 25 864 $ hg graft -f 23
876 grafting 25:bd0c98709948 "26" 865 grafting 23:72d9c7c75bcc "24"
877 note: graft of 25:bd0c98709948 created no changes to commit 866 note: graft of 23:72d9c7c75bcc created no changes to commit
878 867
879 $ cd .. 868 $ cd ..
880 869
881 Graft to duplicate a commit 870 Graft to duplicate a commit
882 871