tests/test-checkheads-partial-C4.t
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
Wed, 29 Mar 2017 15:48:27 +0200
changeset 2249 0ecb9fba6364
child 2251 2f71f6234b06
permissions -rw-r--r--
checkheads: handle partial obsolescence We now properly detects situations were only parts of the remote branch is obsoleted. To do so, we process children in the branch recursively to see if they will be obsolete. The current code has some trouble when the remote branch in unknown locally, or when the prune happened on a successors that is not relevant to the push. These case will be handled later. The processing code is becoming more and more complex, a lighter approach would be to check for the obsolescence markers that are relevant to the pushed set, but I prefer to stick with the current approach until more test cases are written.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2249
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     1
====================================
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     2
Testing head checking code: Case C-4
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     3
====================================
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     4
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     5
Mercurial checks for the introduction of multiple heads on push. Evolution
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     6
comes into play to detect if existing heads on the server are being replaced by
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     7
some of the new heads we push.
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     8
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     9
This test file is part of a series of tests checking this behavior.
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    10
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    11
Category C: checking case were the branch is only partially obsoleted.
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    12
TestCase 4: 2 changeset branch, only the base is pruned
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    13
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    14
.. old-state:
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    15
..
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    16
.. * 2 changeset branch
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    17
..
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    18
.. new-state:
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    19
..
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    20
.. * old base is pruned
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    21
.. * 1 new unrelated branch
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    22
..
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    23
.. expected-result:
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    24
..
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    25
.. * push denied
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    26
..
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    27
.. graph-summary:
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    28
..
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    29
..   B 
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    30
..     |
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    31
..   A   C
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    32
..     |/
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    33
..     
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    34
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    35
  $ . $TESTDIR/testlib/checkheads-util.sh
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    36
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    37
Test setup
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    38
----------
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    39
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    40
  $ setuprepos
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    41
  creating basic server and client repo
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    42
  updating to branch default
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    43
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    44
  $ cd server
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    45
  $ mkcommit B0
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    46
  $ cd ../client
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    47
  $ hg pull
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    48
  pulling from $TESTTMP/server
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    49
  searching for changes
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    50
  adding changesets
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    51
  adding manifests
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    52
  adding file changes
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    53
  added 1 changesets with 1 changes to 1 files
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    54
  (run 'hg update' to get a working copy)
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    55
  $ hg up 0
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    56
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    57
  $ mkcommit C0
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    58
  created new head
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    59
  $ hg debugobsolete `getid "desc(A0)"`
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    60
  $ hg log -G --hidden
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    61
  @  0f88766e02d6 (draft): C0
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    62
  |
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    63
  | o  d73caddc5533 (draft): B0
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    64
  | |
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    65
  | x  8aaa48160adc (draft): A0
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    66
  |/
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    67
  o  1e4be0697311 (public): root
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    68
  
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    69
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    70
Actual testing
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    71
--------------
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    72
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    73
  $ hg push --rev 'desc(C0)'
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    74
  pushing to $TESTTMP/server
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    75
  searching for changes
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    76
  abort: push creates new remote head 0f88766e02d6!
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    77
  (merge or see 'hg help push' for details about pushing new heads)
0ecb9fba6364 checkheads: handle partial obsolescence
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    78
  [255]