tests/test-exchange-obsmarkers-case-B7.t
author Anton Shestakov <av6@dwimlabs.net>
Sat, 06 Apr 2019 15:49:22 +0200
changeset 4477 faf99d48eda9
parent 3566 e6bea259c227
child 3591 98941c28f3e2
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:
2268
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
     1
============================================
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
     2
Testing obsolescence markers push: Cases B.7
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
     3
============================================
843
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
     4
2268
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
     5
Mercurial pushes obsolescences markers relevant to the "pushed-set", the set of
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
     6
all changesets that requested to be "in sync" after the push (even if they are
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
     7
already on both side).
843
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
     8
2268
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
     9
This test belongs to a series of tests checking such set is properly computed
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    10
and applied. This does not tests "obsmarkers" discovery capabilities.
843
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    11
2268
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    12
Category B: pruning case
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    13
TestCase 7: Prune on non-targeted common changeset
843
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    14
2268
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    15
B.7 Prune above non-targeted common changeset
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    16
=============================================
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    17
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    18
.. (very similar to B1, but the prune changeset is unknown on remote)
843
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    19
..
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    20
.. {{{
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    21
..      B
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    22
..     |
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    23
..      A
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    24
..     |
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    25
..      O
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    26
.. }}}
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    27
..
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    28
.. Marker exist from:
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    29
..
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    30
..  * B (prune)
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    31
..
2268
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    32
.. Command runs:
843
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    33
..
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    34
..  * hg push -r O
2268
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    35
..
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    36
.. Expected exclude:
843
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    37
..
2268
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    38
..  * B (prune)
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    39
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    40
Setup
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    41
-----
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    42
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    43
  $ . $TESTDIR/testlib/exchange-obsmarker-util.sh
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    44
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    45
Initial
843
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    46
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    47
  $ setuprepos B.7
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    48
  creating test repo for test case B.7
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    49
  - pulldest
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    50
  - main
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    51
  - pushdest
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    52
  cd into `main` and proceed with env setup
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    53
  $ cd main
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    54
  $ mkcommit A
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    55
  $ hg push -q ../pushdest
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    56
  $ hg push -q ../pulldest
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    57
  $ mkcommit B
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    58
  $ hg prune -qd '0 0' .
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    59
  $ hg log -G --hidden
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    60
  x  f6fbb35d8ac9 (draft): B
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    61
  |
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    62
  @  f5bc6836db60 (draft): A
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    63
  |
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    64
  o  a9bdc8b26820 (public): O
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    65
  
2268
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    66
  $ inspect_obsmarkers
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    67
  obsstore content
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    68
  ================
3566
e6bea259c227 prune: include "operation" metadata in obsmarkers
Martin von Zweigbergk <martinvonz@google.com>
parents: 3559
diff changeset
    69
  f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
2268
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    70
  obshashtree
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    71
  ===========
2083
778afb036245 discovery: introduce a official 'obshash associated to a range
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1093
diff changeset
    72
  a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04 0000000000000000000000000000000000000000
3566
e6bea259c227 prune: include "operation" metadata in obsmarkers
Martin von Zweigbergk <martinvonz@google.com>
parents: 3559
diff changeset
    73
  f5bc6836db60e308a17ba08bf050154ba9c4fad7 26563406db05b110410fcfb692bd66c212f15c7a
e6bea259c227 prune: include "operation" metadata in obsmarkers
Martin von Zweigbergk <martinvonz@google.com>
parents: 3559
diff changeset
    74
  f6fbb35d8ac958bbe70035e4c789c18471cdc0af 8dff6be5bc7194357b78e44acc79f138eedc075a
2268
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    75
  obshashrange
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    76
  ============
2228
3b18440cca74 debugstablerange: improve output spacing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2118
diff changeset
    77
           rev         node        index         size        depth      obshash
3566
e6bea259c227 prune: include "operation" metadata in obsmarkers
Martin von Zweigbergk <martinvonz@google.com>
parents: 3559
diff changeset
    78
             1 f5bc6836db60            0            2            2 26563406db05
2228
3b18440cca74 debugstablerange: improve output spacing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2118
diff changeset
    79
             0 a9bdc8b26820            0            1            1 000000000000
3566
e6bea259c227 prune: include "operation" metadata in obsmarkers
Martin von Zweigbergk <martinvonz@google.com>
parents: 3559
diff changeset
    80
             1 f5bc6836db60            1            1            2 26563406db05
843
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    81
  $ cd ..
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    82
  $ cd ..
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    83
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    84
Actual Test
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    85
-------------------------------------
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    86
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    87
  $ dotest B.7 O
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    88
  ## Running testcase B.7
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    89
  # testing echange of "O" (a9bdc8b26820)
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    90
  ## initial state
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    91
  # obstore: main
3566
e6bea259c227 prune: include "operation" metadata in obsmarkers
Martin von Zweigbergk <martinvonz@google.com>
parents: 3559
diff changeset
    92
  f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
843
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    93
  # obstore: pushdest
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    94
  # obstore: pulldest
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    95
  ## pushing "O" from main to pushdest
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    96
  pushing to pushdest
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    97
  searching for changes
1078
5717d023da63 obsexc: use the common discovery
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1067
diff changeset
    98
  no changes found
843
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    99
  ## post push state
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
   100
  # obstore: main
3566
e6bea259c227 prune: include "operation" metadata in obsmarkers
Martin von Zweigbergk <martinvonz@google.com>
parents: 3559
diff changeset
   101
  f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
843
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
   102
  # obstore: pushdest
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
   103
  # obstore: pulldest
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
   104
  ## pulling "a9bdc8b26820" from main into pulldest
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
   105
  pulling from main
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
   106
  no changes found
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
   107
  ## post pull state
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
   108
  # obstore: main
3566
e6bea259c227 prune: include "operation" metadata in obsmarkers
Martin von Zweigbergk <martinvonz@google.com>
parents: 3559
diff changeset
   109
  f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
843
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
   110
  # obstore: pushdest
ee910ba7a9db exchange: add test case for B.7
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
   111
  # obstore: pulldest