diff 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
line wrap: on
line diff
--- a/tests/test-commit-amend.t	Sat Jul 13 23:45:32 2019 -0400
+++ b/tests/test-commit-amend.t	Tue Jul 02 12:59:58 2019 -0400
@@ -649,7 +649,7 @@
   (no more unresolved files)
   $ hg ci -m 'merge bar'
   $ hg log --config diff.git=1 -pr .
-  changeset:   20:163cfd7219f7
+  changeset:   20:5aba7f3726e6
   tag:         tip
   parent:      19:30d96aeaf27b
   parent:      18:1aa437659d19
@@ -682,7 +682,7 @@
   $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit
   HGEDITFORM=commit.amend.merge
   $ hg log --config diff.git=1 -pr .
-  changeset:   21:bca52d4ed186
+  changeset:   21:4b0631ef043e
   tag:         tip
   parent:      19:30d96aeaf27b
   parent:      18:1aa437659d19
@@ -715,7 +715,7 @@
   $ hg mv zz z
   $ hg ci --amend -m 'merge bar (undo rename)'
   $ hg log --config diff.git=1 -pr .
-  changeset:   22:12594a98ca3f
+  changeset:   22:06423be42d60
   tag:         tip
   parent:      19:30d96aeaf27b
   parent:      18:1aa437659d19
@@ -751,9 +751,9 @@
   $ echo aa >> aaa
   $ hg ci -m 'merge bar again'
   $ hg log --config diff.git=1 -pr .
-  changeset:   24:dffde028b388
+  changeset:   24:a89974a20457
   tag:         tip
-  parent:      22:12594a98ca3f
+  parent:      22:06423be42d60
   parent:      23:4c94d5bc65f5
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
@@ -800,9 +800,9 @@
   $ hg mv aaa aa
   $ hg ci --amend -m 'merge bar again (undo rename)'
   $ hg log --config diff.git=1 -pr .
-  changeset:   25:18e3ba160489
+  changeset:   25:282080768800
   tag:         tip
-  parent:      22:12594a98ca3f
+  parent:      22:06423be42d60
   parent:      23:4c94d5bc65f5
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
@@ -843,9 +843,9 @@
   What do you want to do? c
   $ hg ci -m 'merge bar (with conflicts)'
   $ hg log --config diff.git=1 -pr .
-  changeset:   28:b4c3035e2544
+  changeset:   28:ed15db12298d
   tag:         tip
-  parent:      27:4b216ca5ba97
+  parent:      27:eb5adec0b43b
   parent:      26:67db8847a540
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
@@ -855,9 +855,9 @@
   $ hg rm aa
   $ hg ci --amend -m 'merge bar (with conflicts, amended)'
   $ hg log --config diff.git=1 -pr .
-  changeset:   29:1205ed810051
+  changeset:   29:0eeafd043f63
   tag:         tip
-  parent:      27:4b216ca5ba97
+  parent:      27:eb5adec0b43b
   parent:      26:67db8847a540
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
@@ -974,7 +974,7 @@
   HG: M: 
   HG: A: foo
   HG: R: 
-  HG: diff -r 1205ed810051 foo
+  HG: diff -r 0eeafd043f63 foo
   HG: --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   HG: +++ b/foo	Thu Jan 01 00:00:00 1970 +0000
   HG: @@ -0,0 +1,1 @@
@@ -988,12 +988,12 @@
   HG: M: 
   HG: A: foo y
   HG: R: 
-  HG: diff -r 1205ed810051 foo
+  HG: diff -r 0eeafd043f63 foo
   HG: --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   HG: +++ b/foo	Thu Jan 01 00:00:00 1970 +0000
   HG: @@ -0,0 +1,1 @@
   HG: +foo
-  HG: diff -r 1205ed810051 y
+  HG: diff -r 0eeafd043f63 y
   HG: --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   HG: +++ b/y	Thu Jan 01 00:00:00 1970 +0000
   HG: @@ -0,0 +1,1 @@
@@ -1006,18 +1006,18 @@
   HG: M: 
   HG: A: foo y
   HG: R: a
-  HG: diff -r 1205ed810051 a
+  HG: diff -r 0eeafd043f63 a
   HG: --- a/a	Thu Jan 01 00:00:00 1970 +0000
   HG: +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   HG: @@ -1,2 +0,0 @@
   HG: -a
   HG: -a
-  HG: diff -r 1205ed810051 foo
+  HG: diff -r 0eeafd043f63 foo
   HG: --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   HG: +++ b/foo	Thu Jan 01 00:00:00 1970 +0000
   HG: @@ -0,0 +1,1 @@
   HG: +foo
-  HG: diff -r 1205ed810051 y
+  HG: diff -r 0eeafd043f63 y
   HG: --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   HG: +++ b/y	Thu Jan 01 00:00:00 1970 +0000
   HG: @@ -0,0 +1,1 @@
@@ -1030,23 +1030,23 @@
   HG: M: 
   HG: A: foo y
   HG: R: a x
-  HG: diff -r 1205ed810051 a
+  HG: diff -r 0eeafd043f63 a
   HG: --- a/a	Thu Jan 01 00:00:00 1970 +0000
   HG: +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   HG: @@ -1,2 +0,0 @@
   HG: -a
   HG: -a
-  HG: diff -r 1205ed810051 foo
+  HG: diff -r 0eeafd043f63 foo
   HG: --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   HG: +++ b/foo	Thu Jan 01 00:00:00 1970 +0000
   HG: @@ -0,0 +1,1 @@
   HG: +foo
-  HG: diff -r 1205ed810051 x
+  HG: diff -r 0eeafd043f63 x
   HG: --- a/x	Thu Jan 01 00:00:00 1970 +0000
   HG: +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   HG: @@ -1,1 +0,0 @@
   HG: -x
-  HG: diff -r 1205ed810051 y
+  HG: diff -r 0eeafd043f63 y
   HG: --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   HG: +++ b/y	Thu Jan 01 00:00:00 1970 +0000
   HG: @@ -0,0 +1,1 @@
@@ -1061,23 +1061,23 @@
   HG: M: 
   HG: A: foo y
   HG: R: a x
-  HG: diff -r 1205ed810051 a
+  HG: diff -r 0eeafd043f63 a
   HG: --- a/a	Thu Jan 01 00:00:00 1970 +0000
   HG: +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   HG: @@ -1,2 +0,0 @@
   HG: -a
   HG: -a
-  HG: diff -r 1205ed810051 foo
+  HG: diff -r 0eeafd043f63 foo
   HG: --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   HG: +++ b/foo	Thu Jan 01 00:00:00 1970 +0000
   HG: @@ -0,0 +1,1 @@
   HG: +foo
-  HG: diff -r 1205ed810051 x
+  HG: diff -r 0eeafd043f63 x
   HG: --- a/x	Thu Jan 01 00:00:00 1970 +0000
   HG: +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   HG: @@ -1,1 +0,0 @@
   HG: -x
-  HG: diff -r 1205ed810051 y
+  HG: diff -r 0eeafd043f63 y
   HG: --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   HG: +++ b/y	Thu Jan 01 00:00:00 1970 +0000
   HG: @@ -0,0 +1,1 @@