tests/test-push-checkheads-multibranches-E1.t
author Kyle Lippincott <spectral@google.com>
Wed, 31 Mar 2021 12:46:54 -0700
changeset 46872 8bca353b1ebc
parent 44450 7d5455b988ec
permissions -rw-r--r--
match: convert O(n) to O(log n) in exactmatcher.visitchildrenset When using narrow, during rebase this is called (at least) once per directory in the set of files in the commit being rebased. Every time it's called, we did the set arithmetic (now extracted and cached), which was probably pretty cheap but not necessary to repeat each time, looped over every item in the matcher and kept things that started with the directory we were querying. With very large narrowspecs, and a commit that touched a file in a large number of directories, this was slow. In a pathological repo, the rebase of a single commit (that touched over 17k files, I believe in approximately as many directories) with a narrowspec that had >32k entries took 8,246s of profiled time, with 5,007s of that spent in visitchildrenset (transitively). With this change, the time spent in visitchildrenset is less than 34s (which is where my profile cut off). Most of the remaining time was network access due to our custom remotefilelog-based setup not properly prefetching. Differential Revision: https://phab.mercurial-scm.org/D10294
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
44450
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     1
====================================
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     2
Testing head checking code: Case E-1
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     3
====================================
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     4
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     5
Mercurial checks for the introduction of new heads on push. Evolution comes
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     6
into play to detect if existing branches on the server are being replaced by
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     7
some of the new one we push.
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     8
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     9
This case is part of a series of tests checking this behavior.
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    10
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    11
Category E: case involving changeset on multiple branch
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    12
TestCase 8: moving a branch to another location
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    13
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    14
.. old-state:
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    15
..
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    16
.. * 1-changeset on branch default
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    17
.. * 1-changeset on branch Z (above default)
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    18
..
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    19
.. new-state:
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    20
..
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    21
.. * 1-changeset on branch default
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    22
.. * 1-changeset on branch Z (rebased away from A0)
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    23
..
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    24
.. expected-result:
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    25
..
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    26
.. * push allowed
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    27
..
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    28
.. graph-summary:
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    29
..
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    30
..   B ø⇠◔ B'
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    31
..     | |
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    32
..   A ◔ |
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    33
..     |/
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    34
..     ●
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    35
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    36
  $ . $TESTDIR/testlib/push-checkheads-util.sh
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    37
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    38
Test setup
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    39
----------
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    40
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    41
  $ mkdir E1
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    42
  $ cd E1
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    43
  $ setuprepos
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    44
  creating basic server and client repo
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    45
  updating to branch default
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    46
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    47
  $ cd client
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    48
  $ hg branch Z
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    49
  marked working directory as branch Z
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    50
  (branches are permanent and global, did you want a bookmark?)
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    51
  $ mkcommit B0
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    52
  $ hg push --new-branch
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    53
  pushing to $TESTTMP/E1/server
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    54
  searching for changes
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    55
  adding changesets
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    56
  adding manifests
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    57
  adding file changes
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    58
  added 1 changesets with 1 changes to 1 files
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    59
  $ hg up 0
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    60
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    61
  $ hg branch --force Z
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    62
  marked working directory as branch Z
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    63
  $ mkcommit B1
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    64
  created new head
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    65
  $ hg debugobsolete `getid "desc(B0)" ` `getid "desc(B1)"`
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    66
  1 new obsolescence markers
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    67
  obsoleted 1 changesets
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    68
  $ hg log -G --hidden
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    69
  @  c98b855401e7 (draft): B1
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    70
  |
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    71
  | x  93e5c1321ece (draft): B0
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    72
  | |
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    73
  | o  8aaa48160adc (draft): A0
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    74
  |/
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    75
  o  1e4be0697311 (public): root
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    76
  
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    77
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    78
Actual testing
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    79
--------------
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    80
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    81
  $ hg push
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    82
  pushing to $TESTTMP/E1/server
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    83
  searching for changes
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    84
  adding changesets
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    85
  adding manifests
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    86
  adding file changes
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    87
  added 1 changesets with 1 changes to 1 files (+1 heads)
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    88
  1 new obsolescence markers
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    89
  obsoleted 1 changesets
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    90
7d5455b988ec discovery: avoid wrong detection of multiple branch heads (issue6256)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    91
  $ cd ../..