tests/test-diff-antipatience.t
author Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
Tue, 02 Jul 2019 12:59:58 -0400
changeset 42621 99ebde4fec99
parent 38469 9ef9884e5d50
permissions -rw-r--r--
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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36678
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
     1
#testcases bdiff xdiff
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
     2
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
     3
#if xdiff
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
     4
#require xdiff
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
     5
  $ cat >> $HGRCPATH <<EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
     6
  > [experimental]
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
     7
  > xdiff = true
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
     8
  > EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
     9
#endif
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    10
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    11
Test case that makes use of the weakness of patience diff algorithm
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    12
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    13
  $ hg init
38469
9ef9884e5d50 py3: make tests/test-diff-antipatience.t work with python 3
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36678
diff changeset
    14
  >>> open('a', 'wb').write(('\n'.join(list('a' + 'x' * 10 + 'u' + 'x' * 30 + 'a\n'))).encode('ascii')) and None
36678
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    15
  $ hg commit -m 1 -A a
38469
9ef9884e5d50 py3: make tests/test-diff-antipatience.t work with python 3
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36678
diff changeset
    16
  >>> open('a', 'wb').write(('\n'.join(list('b' + 'x' * 30 + 'u' + 'x' * 10 + 'b\n'))).encode('ascii')) and None
36678
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    17
#if xdiff
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    18
  $ hg diff
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    19
  diff -r f0aeecb49805 a
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    20
  --- a/a	Thu Jan 01 00:00:00 1970 +0000
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    21
  +++ b/a	Thu Jan 01 00:00:00 1970 +0000
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    22
  @@ -1,4 +1,4 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    23
  -a
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    24
  +b
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    25
   x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    26
   x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    27
   x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    28
  @@ -9,7 +9,6 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    29
   x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    30
   x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    31
   x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    32
  -u
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    33
   x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    34
   x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    35
   x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    36
  @@ -30,6 +29,7 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    37
   x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    38
   x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    39
   x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    40
  +u
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    41
   x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    42
   x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    43
   x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    44
  @@ -40,5 +40,5 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    45
   x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    46
   x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    47
   x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    48
  -a
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    49
  +b
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    50
   
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    51
#else
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    52
  $ hg diff
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    53
  diff -r f0aeecb49805 a
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    54
  --- a/a	Thu Jan 01 00:00:00 1970 +0000
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    55
  +++ b/a	Thu Jan 01 00:00:00 1970 +0000
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    56
  @@ -1,15 +1,4 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    57
  -a
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    58
  -x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    59
  -x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    60
  -x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    61
  -x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    62
  -x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    63
  -x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    64
  -x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    65
  -x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    66
  -x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    67
  -x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    68
  -u
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    69
  +b
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    70
   x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    71
   x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    72
   x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    73
  @@ -40,5 +29,16 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    74
   x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    75
   x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    76
   x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    77
  -a
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    78
  +u
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    79
  +x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    80
  +x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    81
  +x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    82
  +x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    83
  +x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    84
  +x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    85
  +x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    86
  +x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    87
  +x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    88
  +x
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    89
  +b
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    90
   
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    91
#endif