tests/test-exchange-obsmarkers-case-B1.t
author Sushil khanchi <sushilkhanchi97@gmail.com>
Sat, 23 Mar 2019 02:10:31 +0530
changeset 4442 819bad275701
parent 3566 e6bea259c227
child 3591 98941c28f3e2
permissions -rw-r--r--
evolve: add logic to handle a particular case in divergence resolution Case is: In content divergence, to check if the two csets are on different parent or same parent what we do is find gca of the two csets and then compare it with the singlesuccessors of two csets's parents. Now, if gca is same as singlesuccessors of both the csets then we conclude that both are on the same parent which is not totally correct as it is possible that both the parents of two csets are obsolete with a single successor. This patch adds the logic to cover the above metioned case correctly, deciding the part when we need to relocate a cset to other side while resolving the stack of divergent csets. Changes in test file demonstrate that before this patch we were not doing it right because it should have relocated every node to other side instead of just relocating the first one from the stack.
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.1
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
     3
============================================
837
64f75c5c4f7f exchange: add test case for B.1
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).
837
64f75c5c4f7f exchange: add test case for B.1
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.
837
64f75c5c4f7f exchange: add test case for B.1
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 1: Prune on 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
    14
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    15
B.1 Prune on 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
==========================================
837
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    17
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    18
.. {{{
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    19
..      B
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    20
..     |
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    21
..      A
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    22
..     |
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    23
..      O
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    24
.. }}}
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    25
..
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    26
.. Marker exist from:
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    27
..
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    28
..  * B (prune)
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    29
..
2268
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    30
.. Command runs:
837
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    31
..
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    32
..  * hg push -r O
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    33
..
2268
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    34
.. Expected exclude:
837
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    35
..
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    36
..  * B (prune)
64f75c5c4f7f exchange: add test case for B.1
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
Setup
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
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    41
  $ . $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
    42
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    43
Initial
837
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    44
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    45
  $ setuprepos B.1
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    46
  creating test repo for test case B.1
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    47
  - pulldest
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    48
  - main
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    49
  - pushdest
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    50
  cd into `main` and proceed with env setup
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    51
  $ cd main
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    52
  $ mkcommit A
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    53
  $ mkcommit B
2268
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    54
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    55
make both changeset known in remote
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    56
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    57
  $ hg push -qf ../pushdest
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    58
  $ hg push -qf ../pulldest
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    59
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    60
create prune marker
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    61
837
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    62
  $ hg prune -qd '0 0' .
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    63
  $ hg log -G --hidden
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    64
  x  f6fbb35d8ac9 (draft): B
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    65
  |
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    66
  @  f5bc6836db60 (draft): A
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    67
  |
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    68
  o  a9bdc8b26820 (public): O
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    69
  
2268
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    70
  $ inspect_obsmarkers
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    71
  obsstore content
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    72
  ================
3566
e6bea259c227 prune: include "operation" metadata in obsmarkers
Martin von Zweigbergk <martinvonz@google.com>
parents: 3559
diff changeset
    73
  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
    74
  obshashtree
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    75
  ===========
2083
778afb036245 discovery: introduce a official 'obshash associated to a range
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1093
diff changeset
    76
  a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04 0000000000000000000000000000000000000000
3566
e6bea259c227 prune: include "operation" metadata in obsmarkers
Martin von Zweigbergk <martinvonz@google.com>
parents: 3559
diff changeset
    77
  f5bc6836db60e308a17ba08bf050154ba9c4fad7 26563406db05b110410fcfb692bd66c212f15c7a
e6bea259c227 prune: include "operation" metadata in obsmarkers
Martin von Zweigbergk <martinvonz@google.com>
parents: 3559
diff changeset
    78
  f6fbb35d8ac958bbe70035e4c789c18471cdc0af 8dff6be5bc7194357b78e44acc79f138eedc075a
2268
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    79
  obshashrange
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    80
  ============
2228
3b18440cca74 debugstablerange: improve output spacing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2118
diff changeset
    81
           rev         node        index         size        depth      obshash
3566
e6bea259c227 prune: include "operation" metadata in obsmarkers
Martin von Zweigbergk <martinvonz@google.com>
parents: 3559
diff changeset
    82
             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
    83
             0 a9bdc8b26820            0            1            1 000000000000
3566
e6bea259c227 prune: include "operation" metadata in obsmarkers
Martin von Zweigbergk <martinvonz@google.com>
parents: 3559
diff changeset
    84
             1 f5bc6836db60            1            1            2 26563406db05
837
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    85
  $ cd ..
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    86
  $ cd ..
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    87
2268
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    88
Actual Test
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    89
-----------
837
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    90
2268
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    91
  $ dotest B.1 O
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    92
  ## Running testcase B.1
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    93
  # testing echange of "O" (a9bdc8b26820)
837
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    94
  ## initial state
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    95
  # obstore: main
3566
e6bea259c227 prune: include "operation" metadata in obsmarkers
Martin von Zweigbergk <martinvonz@google.com>
parents: 3559
diff changeset
    96
  f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
837
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    97
  # obstore: pushdest
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    98
  # obstore: pulldest
2268
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
    99
  ## pushing "O" from main to pushdest
837
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
   100
  pushing to pushdest
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
   101
  searching for changes
2268
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
   102
  no changes found
837
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
   103
  ## post push state
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
   104
  # obstore: main
3566
e6bea259c227 prune: include "operation" metadata in obsmarkers
Martin von Zweigbergk <martinvonz@google.com>
parents: 3559
diff changeset
   105
  f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
837
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
   106
  # obstore: pushdest
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
   107
  # obstore: pulldest
2268
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
   108
  ## pulling "a9bdc8b26820" from main into pulldest
837
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
   109
  pulling from main
2268
f2ebe960998b tests: update test to match upstreamable version
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2230
diff changeset
   110
  no changes found
837
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
   111
  ## post pull state
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
   112
  # obstore: main
3566
e6bea259c227 prune: include "operation" metadata in obsmarkers
Martin von Zweigbergk <martinvonz@google.com>
parents: 3559
diff changeset
   113
  f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
837
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
   114
  # obstore: pushdest
64f75c5c4f7f exchange: add test case for B.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
   115
  # obstore: pulldest