tests/test-merge-combination-file-content.t
author Arun Kulshreshtha <akulshreshtha@janestreet.com>
Tue, 30 Aug 2022 15:29:55 -0400
changeset 49491 c6a1beba27e9
parent 46266 e8b0c519dfb3
permissions -rw-r--r--
bisect: avoid copying ancestor list for non-merge commits During a bisection, hg needs to compute a list of all ancestors for every candidate commit. This is accomplished via a bottom-up traversal of the set of candidates, during which each revision's ancestor list is populated using the ancestor list of its parent(s). Previously, this involved copying the entire list, which could be very long in if the bisection range was large. To help improve this, we can observe that each candidate commit is visited exactly once, at which point its ancestor list is copied into its children's lists and then dropped. In the case of non-merge commits, a commit's ancestor list consists exactly of its parent's list plus itself. This means that we can trivially reuse the parent's existing list for one of its non-merge children, which avoids copying entirely if that commit is the parent's only child. This makes bisections over linear ranges of commits much faster. During some informal testing in the large publicly-available `mozilla-central` repository, this noticeably sped up bisections over large ranges of history: Setup: $ cd mozilla-central $ hg bisect --reset $ hg bisect --good 0 $ hg log -r tip -T '{rev}\n' 628417 Test: $ time hg bisect --bad tip --noupdate Before: real 3m35.927s user 3m35.553s sys 0m0.319s After: real 1m41.142s user 1m40.810s sys 0m0.285s
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46266
e8b0c519dfb3 test: split tests/test-merge-combination.t into multiple parts
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46265
diff changeset
     1
Testing recorded "modified" files for merge commit
e8b0c519dfb3 test: split tests/test-merge-combination.t into multiple parts
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46265
diff changeset
     2
==================================================
e8b0c519dfb3 test: split tests/test-merge-combination.t into multiple parts
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46265
diff changeset
     3
42619
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
     4
This file shows what hg says are "modified" files for a merge commit
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
     5
(hg log -T {files}), somewhat exhaustively.
46266
e8b0c519dfb3 test: split tests/test-merge-combination.t into multiple parts
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46265
diff changeset
     6
e8b0c519dfb3 test: split tests/test-merge-combination.t into multiple parts
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46265
diff changeset
     7
This test file shows merges that involves files contents changing
e8b0c519dfb3 test: split tests/test-merge-combination.t into multiple parts
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46265
diff changeset
     8
e8b0c519dfb3 test: split tests/test-merge-combination.t into multiple parts
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46265
diff changeset
     9
For merges taht involves executable bit changing, check test-merge-combination-exec-bytes.t
e8b0c519dfb3 test: split tests/test-merge-combination.t into multiple parts
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46265
diff changeset
    10
e8b0c519dfb3 test: split tests/test-merge-combination.t into multiple parts
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46265
diff changeset
    11
For testing of multiple corner case, check test-merge-combination-misc.t
e8b0c519dfb3 test: split tests/test-merge-combination.t into multiple parts
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46265
diff changeset
    12
e8b0c519dfb3 test: split tests/test-merge-combination.t into multiple parts
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46265
diff changeset
    13
Case with multiple or zero merge ancestors, copies/renames, and identical file contents
e8b0c519dfb3 test: split tests/test-merge-combination.t into multiple parts
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46265
diff changeset
    14
with different filelog revisions are not currently covered.
42619
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    15
46265
8045e4aa366b test: extract the `genmerges` out of test-merge-combination.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42739
diff changeset
    16
  $ . $TESTDIR/testlib/merge-combination-util.sh
42619
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    17
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    18
All the merges of various file contents.
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    19
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    20
  $ range () {
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    21
  >   max=0
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    22
  >   for i in $@; do
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    23
  >     if [ $i = - ]; then continue; fi
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    24
  >     if [ $i -gt $max ]; then max=$i; fi
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    25
  >   done
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    26
  >   $TESTDIR/seq.py `expr $max + 1`
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    27
  > }
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    28
  $ isgood () { true; }
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    29
  $ createfile () {
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    30
  >   if [ -f a ] && [ "`cat a`" = $1 ]
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    31
  >   then touch $file
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    32
  >   else echo $v > a
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    33
  >   fi
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    34
  > }
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    35
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    36
  $ genmerges
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    37
  1111  : agree on ""
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    38
  1112  : agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    39
  111-  : agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    40
  1121  : agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    41
  1122  : agree on ""
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    42
  1123  : agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    43
  112-  : agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    44
  11-1  : hg said "", expected "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    45
  11-2  : agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    46
  11--  : agree on ""
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    47
  1211  : agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    48
  1212  : agree on ""
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    49
  1213  : agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    50
  121-  : agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    51
  1221  : agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    52
  1222  : agree on ""
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    53
  1223  : agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    54
  122-  : agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    55
  1231 C: agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    56
  1232 C: agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    57
  1233 C: agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    58
  1234 C: agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    59
  123- C: agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    60
  12-1 C: agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    61
  12-2 C: hg said "", expected "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    62
  12-3 C: agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    63
  12-- C: agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    64
  1-11  : hg said "", expected "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    65
  1-12  : agree on "a"
42621
99ebde4fec99 commit: improve the files field of changelog for merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 42619
diff changeset
    66
  1-1-  : agree on ""
42619
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    67
  1-21 C: agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    68
  1-22 C: hg said "", expected "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    69
  1-23 C: agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    70
  1-2- C: agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    71
  1--1  : agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    72
  1--2  : agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    73
  1---  : agree on ""
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    74
  -111  : agree on ""
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    75
  -112  : agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    76
  -11-  : agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    77
  -121 C: agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    78
  -122 C: agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    79
  -123 C: agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    80
  -12- C: agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    81
  -1-1  : agree on ""
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    82
  -1-2  : agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    83
  -1--  : agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    84
  --11  : agree on ""
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    85
  --12  : agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    86
  --1-  : agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    87
  ---1  : agree on "a"
20d0e59be79b tests: show the files fields of changelogs for many merges
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff changeset
    88
  ----  : agree on ""