tests/test-push-checkheads-pruned-B7.t
author Anton Shestakov <av6@dwimlabs.net>
Sat, 06 Apr 2019 15:49:22 +0200
changeset 4477 faf99d48eda9
parent 2754 21f06d932231
child 2798 2280461343e5
child 4840 62b60fc1983d
permissions -rw-r--r--
stack: fix phasecache._phasesets check logic When _phasesets is not None, it's a list, and it contains set()s of revisions in a specific phase, starting from public, draft, secret and so on. But since repos are supposed to have the majority of revisions in public phase, the first element of this list is not a (potentially huge) set, but None. Previously this code tried to check if there's any element that is None, and was always finding None at index 0, so the short path was executed every time and the rest of the function was never used.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2254
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     1
====================================
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     2
Testing head checking code: Case B-7
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     3
====================================
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     4
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2254
diff changeset
     5
Mercurial checks for the introduction of new heads on push. Evolution comes
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2254
diff changeset
     6
into play to detect if existing branches on the server are being replaced by
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2254
diff changeset
     7
some of the new one we push.
2254
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     8
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2254
diff changeset
     9
This case is part of a series of tests checking this behavior.
2254
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    10
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2254
diff changeset
    11
Category B: simple case involving pruned changesets
2254
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    12
TestCase 7: single changesets, pruned then superseeded (on an existing changeset)
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    13
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    14
.. old-state:
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    15
..
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    16
.. * 1 changeset branch
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    17
..
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    18
.. new-state:
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    19
..
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    20
.. * old branch is rewritten onto the common set,
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    21
.. * the new version is then pruned.
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    22
..
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    23
.. expected-result:
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    24
..
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    25
.. * push allowed
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    26
..
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    27
.. graph-summary:
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    28
..
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    29
..   A ø⇠⊗ A'
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    30
.. B ◔ | |
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    31
..    \|/
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    32
..     ●
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    33
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2254
diff changeset
    34
  $ . $TESTDIR/testlib/push-checkheads-util.sh
2254
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    35
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    36
Test setup
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    37
----------
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    38
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2254
diff changeset
    39
  $ mkdir B7
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2254
diff changeset
    40
  $ cd B7
2254
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    41
  $ setuprepos
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    42
  creating basic server and client repo
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    43
  updating to branch default
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    44
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    45
  $ cd client
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    46
  $ hg up 0
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    47
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    48
  $ mkcommit B0
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    49
  created new head
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    50
  $ mkcommit A1
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    51
  $ hg up 'desc(B0)'
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    52
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    53
  $ hg debugobsolete `getid "desc(A0)"` `getid "desc(A1)"`
2754
21f06d932231 test: update test output to match b11e8c67fb0f
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2710
diff changeset
    54
  obsoleted 1 changesets
2254
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    55
  $ hg debugobsolete --record-parents `getid "desc(A1)"`
2754
21f06d932231 test: update test output to match b11e8c67fb0f
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2710
diff changeset
    56
  obsoleted 1 changesets
2254
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    57
  $ hg log -G --hidden
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    58
  x  ba93660aff8d (draft): A1
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    59
  |
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    60
  @  74ff5441d343 (draft): B0
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    61
  |
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    62
  | x  8aaa48160adc (draft): A0
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    63
  |/
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    64
  o  1e4be0697311 (public): root
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    65
  
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    66
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    67
Actual testing
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    68
--------------
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    69
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    70
  $ hg push
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2254
diff changeset
    71
  pushing to $TESTTMP/B7/server (glob)
2254
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    72
  searching for changes
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    73
  adding changesets
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    74
  adding manifests
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    75
  adding file changes
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    76
  added 1 changesets with 1 changes to 1 files (+1 heads)
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    77
  2 new obsolescence markers
2710
e22de367fc74 compat: adapt to change in 53b3a1968aa6-core
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2277
diff changeset
    78
  obsoleted 1 changesets
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2254
diff changeset
    79
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2254
diff changeset
    80
  $ cd ../..