comparison tests/test-commit-amend.t @ 42621:99ebde4fec99

commit: improve the files field of changelog for merges Currently, the files list of merge commits repeats all the deletions (either actual deletions, or files that got renamed) that happened between base and p2 of the merge. If p2 is the main branch, the list can easily be much bigger than the change being merged. This results in various problems worth improving: - changelog is bigger than necessary - `hg log directory` lists many unrelated merge commits, and `hg log -v -r commit` frequently fills multiple screens worth of files - it possibly slows down adjustlinkrev, by forcing it to read more manifests, and that function can certainly be a bottleneck - the server side of pulls can waste a lot of time simply opening the filelogs for pointless files (the constant factors for opening even a tiny filelog is apparently pretty bad) So stop listing such files as described in the code. Impacted merge commits and their descendants get a different hash than they would have without this. This doesn't seem problematic, except for convert. The previous commit helped with that in the hg->hg case (but if you do svn->hg twice from scratch, hashes can still change). The rest of the description is numbers. I don't have much to report, because recreating the files list of existing repositories is not easy: - debugupgradeformat and bundle/unbundle don't recreate the list - export/import tends to choke quickly applying patches or on description that contain diffs, - merge commits from the convert extension don't have the right files list for reasons orthogonal to the current commit - replaying the merge with hg update/hg merge/hg revert --all/hg commit can end up failing in hg revert - I wasn't sure that using debugsetparents + debugrebuilddirstate would really build the right thing I measured commit time before and after this change, in a case with no files filtered out, several files filtered out (no difference) and 5k files filtered out (+1% time). Recreating the 100 more recent merges in a private repo, the concatenated uncompressed files lists goes from 1.12MB to 0.52MB. Excluding 3 merges that are not representative, then the size goes from 570k to 15k. I converted part of mozilla-central, and observed file list shrinking quite a bit too, starting at the very first merge, 733641d9feaf, going from 550 files to 10 files (although they have relatively few merges, so they probably wouldn't care). Differential Revision: https://phab.mercurial-scm.org/D6613
author Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
date Tue, 02 Jul 2019 12:59:58 -0400
parents 4764e8436b2a
children 8d72e29ad1e0
comparison
equal deleted inserted replaced
42620:d98ec36be808 42621:99ebde4fec99
647 [1] 647 [1]
648 $ hg resolve -m cc 648 $ hg resolve -m cc
649 (no more unresolved files) 649 (no more unresolved files)
650 $ hg ci -m 'merge bar' 650 $ hg ci -m 'merge bar'
651 $ hg log --config diff.git=1 -pr . 651 $ hg log --config diff.git=1 -pr .
652 changeset: 20:163cfd7219f7 652 changeset: 20:5aba7f3726e6
653 tag: tip 653 tag: tip
654 parent: 19:30d96aeaf27b 654 parent: 19:30d96aeaf27b
655 parent: 18:1aa437659d19 655 parent: 18:1aa437659d19
656 user: test 656 user: test
657 date: Thu Jan 01 00:00:00 1970 +0000 657 date: Thu Jan 01 00:00:00 1970 +0000
680 $ hg debugrename cc 680 $ hg debugrename cc
681 cc not renamed 681 cc not renamed
682 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit 682 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit
683 HGEDITFORM=commit.amend.merge 683 HGEDITFORM=commit.amend.merge
684 $ hg log --config diff.git=1 -pr . 684 $ hg log --config diff.git=1 -pr .
685 changeset: 21:bca52d4ed186 685 changeset: 21:4b0631ef043e
686 tag: tip 686 tag: tip
687 parent: 19:30d96aeaf27b 687 parent: 19:30d96aeaf27b
688 parent: 18:1aa437659d19 688 parent: 18:1aa437659d19
689 user: test 689 user: test
690 date: Thu Jan 01 00:00:00 1970 +0000 690 date: Thu Jan 01 00:00:00 1970 +0000
713 $ hg debugrename cc 713 $ hg debugrename cc
714 cc not renamed 714 cc not renamed
715 $ hg mv zz z 715 $ hg mv zz z
716 $ hg ci --amend -m 'merge bar (undo rename)' 716 $ hg ci --amend -m 'merge bar (undo rename)'
717 $ hg log --config diff.git=1 -pr . 717 $ hg log --config diff.git=1 -pr .
718 changeset: 22:12594a98ca3f 718 changeset: 22:06423be42d60
719 tag: tip 719 tag: tip
720 parent: 19:30d96aeaf27b 720 parent: 19:30d96aeaf27b
721 parent: 18:1aa437659d19 721 parent: 18:1aa437659d19
722 user: test 722 user: test
723 date: Thu Jan 01 00:00:00 1970 +0000 723 date: Thu Jan 01 00:00:00 1970 +0000
749 $ hg merge -q bar 749 $ hg merge -q bar
750 $ hg mv aa aaa 750 $ hg mv aa aaa
751 $ echo aa >> aaa 751 $ echo aa >> aaa
752 $ hg ci -m 'merge bar again' 752 $ hg ci -m 'merge bar again'
753 $ hg log --config diff.git=1 -pr . 753 $ hg log --config diff.git=1 -pr .
754 changeset: 24:dffde028b388 754 changeset: 24:a89974a20457
755 tag: tip 755 tag: tip
756 parent: 22:12594a98ca3f 756 parent: 22:06423be42d60
757 parent: 23:4c94d5bc65f5 757 parent: 23:4c94d5bc65f5
758 user: test 758 user: test
759 date: Thu Jan 01 00:00:00 1970 +0000 759 date: Thu Jan 01 00:00:00 1970 +0000
760 summary: merge bar again 760 summary: merge bar again
761 761
798 2 files updated, 0 files merged, 1 files removed, 0 files unresolved 798 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
799 799
800 $ hg mv aaa aa 800 $ hg mv aaa aa
801 $ hg ci --amend -m 'merge bar again (undo rename)' 801 $ hg ci --amend -m 'merge bar again (undo rename)'
802 $ hg log --config diff.git=1 -pr . 802 $ hg log --config diff.git=1 -pr .
803 changeset: 25:18e3ba160489 803 changeset: 25:282080768800
804 tag: tip 804 tag: tip
805 parent: 22:12594a98ca3f 805 parent: 22:06423be42d60
806 parent: 23:4c94d5bc65f5 806 parent: 23:4c94d5bc65f5
807 user: test 807 user: test
808 date: Thu Jan 01 00:00:00 1970 +0000 808 date: Thu Jan 01 00:00:00 1970 +0000
809 summary: merge bar again (undo rename) 809 summary: merge bar again (undo rename)
810 810
841 file 'aa' was deleted in other [merge rev] but was modified in local [working copy]. 841 file 'aa' was deleted in other [merge rev] but was modified in local [working copy].
842 You can use (c)hanged version, (d)elete, or leave (u)nresolved. 842 You can use (c)hanged version, (d)elete, or leave (u)nresolved.
843 What do you want to do? c 843 What do you want to do? c
844 $ hg ci -m 'merge bar (with conflicts)' 844 $ hg ci -m 'merge bar (with conflicts)'
845 $ hg log --config diff.git=1 -pr . 845 $ hg log --config diff.git=1 -pr .
846 changeset: 28:b4c3035e2544 846 changeset: 28:ed15db12298d
847 tag: tip 847 tag: tip
848 parent: 27:4b216ca5ba97 848 parent: 27:eb5adec0b43b
849 parent: 26:67db8847a540 849 parent: 26:67db8847a540
850 user: test 850 user: test
851 date: Thu Jan 01 00:00:00 1970 +0000 851 date: Thu Jan 01 00:00:00 1970 +0000
852 summary: merge bar (with conflicts) 852 summary: merge bar (with conflicts)
853 853
854 854
855 $ hg rm aa 855 $ hg rm aa
856 $ hg ci --amend -m 'merge bar (with conflicts, amended)' 856 $ hg ci --amend -m 'merge bar (with conflicts, amended)'
857 $ hg log --config diff.git=1 -pr . 857 $ hg log --config diff.git=1 -pr .
858 changeset: 29:1205ed810051 858 changeset: 29:0eeafd043f63
859 tag: tip 859 tag: tip
860 parent: 27:4b216ca5ba97 860 parent: 27:eb5adec0b43b
861 parent: 26:67db8847a540 861 parent: 26:67db8847a540
862 user: test 862 user: test
863 date: Thu Jan 01 00:00:00 1970 +0000 863 date: Thu Jan 01 00:00:00 1970 +0000
864 summary: merge bar (with conflicts, amended) 864 summary: merge bar (with conflicts, amended)
865 865
972 expecting diff of foo 972 expecting diff of foo
973 973
974 HG: M: 974 HG: M:
975 HG: A: foo 975 HG: A: foo
976 HG: R: 976 HG: R:
977 HG: diff -r 1205ed810051 foo 977 HG: diff -r 0eeafd043f63 foo
978 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 978 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
979 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 979 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
980 HG: @@ -0,0 +1,1 @@ 980 HG: @@ -0,0 +1,1 @@
981 HG: +foo 981 HG: +foo
982 982
986 expecting diff of foo and y 986 expecting diff of foo and y
987 987
988 HG: M: 988 HG: M:
989 HG: A: foo y 989 HG: A: foo y
990 HG: R: 990 HG: R:
991 HG: diff -r 1205ed810051 foo 991 HG: diff -r 0eeafd043f63 foo
992 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 992 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
993 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 993 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
994 HG: @@ -0,0 +1,1 @@ 994 HG: @@ -0,0 +1,1 @@
995 HG: +foo 995 HG: +foo
996 HG: diff -r 1205ed810051 y 996 HG: diff -r 0eeafd043f63 y
997 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 997 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
998 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 998 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
999 HG: @@ -0,0 +1,1 @@ 999 HG: @@ -0,0 +1,1 @@
1000 HG: +y 1000 HG: +y
1001 1001
1004 expecting diff of a, foo and y 1004 expecting diff of a, foo and y
1005 1005
1006 HG: M: 1006 HG: M:
1007 HG: A: foo y 1007 HG: A: foo y
1008 HG: R: a 1008 HG: R: a
1009 HG: diff -r 1205ed810051 a 1009 HG: diff -r 0eeafd043f63 a
1010 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 1010 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1011 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 1011 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1012 HG: @@ -1,2 +0,0 @@ 1012 HG: @@ -1,2 +0,0 @@
1013 HG: -a 1013 HG: -a
1014 HG: -a 1014 HG: -a
1015 HG: diff -r 1205ed810051 foo 1015 HG: diff -r 0eeafd043f63 foo
1016 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1016 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1017 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 1017 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1018 HG: @@ -0,0 +1,1 @@ 1018 HG: @@ -0,0 +1,1 @@
1019 HG: +foo 1019 HG: +foo
1020 HG: diff -r 1205ed810051 y 1020 HG: diff -r 0eeafd043f63 y
1021 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1021 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1022 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 1022 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1023 HG: @@ -0,0 +1,1 @@ 1023 HG: @@ -0,0 +1,1 @@
1024 HG: +y 1024 HG: +y
1025 1025
1028 expecting diff of a, foo, x and y 1028 expecting diff of a, foo, x and y
1029 1029
1030 HG: M: 1030 HG: M:
1031 HG: A: foo y 1031 HG: A: foo y
1032 HG: R: a x 1032 HG: R: a x
1033 HG: diff -r 1205ed810051 a 1033 HG: diff -r 0eeafd043f63 a
1034 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 1034 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1035 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 1035 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1036 HG: @@ -1,2 +0,0 @@ 1036 HG: @@ -1,2 +0,0 @@
1037 HG: -a 1037 HG: -a
1038 HG: -a 1038 HG: -a
1039 HG: diff -r 1205ed810051 foo 1039 HG: diff -r 0eeafd043f63 foo
1040 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1040 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1041 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 1041 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1042 HG: @@ -0,0 +1,1 @@ 1042 HG: @@ -0,0 +1,1 @@
1043 HG: +foo 1043 HG: +foo
1044 HG: diff -r 1205ed810051 x 1044 HG: diff -r 0eeafd043f63 x
1045 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000 1045 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
1046 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 1046 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1047 HG: @@ -1,1 +0,0 @@ 1047 HG: @@ -1,1 +0,0 @@
1048 HG: -x 1048 HG: -x
1049 HG: diff -r 1205ed810051 y 1049 HG: diff -r 0eeafd043f63 y
1050 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1050 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1051 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 1051 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1052 HG: @@ -0,0 +1,1 @@ 1052 HG: @@ -0,0 +1,1 @@
1053 HG: +y 1053 HG: +y
1054 1054
1059 cc should be excluded 1059 cc should be excluded
1060 1060
1061 HG: M: 1061 HG: M:
1062 HG: A: foo y 1062 HG: A: foo y
1063 HG: R: a x 1063 HG: R: a x
1064 HG: diff -r 1205ed810051 a 1064 HG: diff -r 0eeafd043f63 a
1065 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 1065 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1066 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 1066 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1067 HG: @@ -1,2 +0,0 @@ 1067 HG: @@ -1,2 +0,0 @@
1068 HG: -a 1068 HG: -a
1069 HG: -a 1069 HG: -a
1070 HG: diff -r 1205ed810051 foo 1070 HG: diff -r 0eeafd043f63 foo
1071 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1071 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1072 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 1072 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1073 HG: @@ -0,0 +1,1 @@ 1073 HG: @@ -0,0 +1,1 @@
1074 HG: +foo 1074 HG: +foo
1075 HG: diff -r 1205ed810051 x 1075 HG: diff -r 0eeafd043f63 x
1076 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000 1076 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
1077 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 1077 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1078 HG: @@ -1,1 +0,0 @@ 1078 HG: @@ -1,1 +0,0 @@
1079 HG: -x 1079 HG: -x
1080 HG: diff -r 1205ed810051 y 1080 HG: diff -r 0eeafd043f63 y
1081 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1081 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1082 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 1082 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1083 HG: @@ -0,0 +1,1 @@ 1083 HG: @@ -0,0 +1,1 @@
1084 HG: +y 1084 HG: +y
1085 1085