tests/test-single-head-obsolescence-named-branch-A2.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Tue, 17 May 2022 14:25:53 +0100
changeset 49322 d587f09cad98
parent 48688 053a5bf508da
permissions -rw-r--r--
bundlespec: make the `stream` case less special The handling of the stream case seems fragile (does not account for newer parts and options that will arise) and has special code dedicated to it. To simplify and strengthen things, we make it use the same mechanism as the other options. So we make it less special by making it a special value in the common case.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
48688
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     1
=========================================
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     2
Testing single head enforcement: Case A-2
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     3
=========================================
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     4
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     5
A repository is set to only accept a single head per name (typically named
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     6
branch). However, obsolete changesets can make this enforcement more
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     7
complicated, because they can be kept visible by other changeset on other
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     8
branch.
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     9
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    10
This case is part of a series of tests checking this behavior.
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    11
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    12
Category A: Involving obsolescence
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    13
TestCase 2: A branch is split in two, effectively creating two heads
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    14
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    15
.. old-state:
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    16
..
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    17
.. * 2 changesets on branch default
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    18
.. * 2 changesets on branch Z on top of them
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    19
..
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    20
.. new-state:
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    21
..
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    22
.. * 2 changesets on branch Z at the same location
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    23
.. * 1 changeset on branch default unchanged
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    24
.. * 1 changeset on branch default superseding the other ones
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    25
..
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    26
.. expected-result:
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    27
..
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    28
.. * two heads detected
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    29
..
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    30
.. graph-summary:
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    31
..
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    32
..   D ●      (branch Z)
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    33
..     |
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    34
..   C ●      (branch Z)
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    35
..     |
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    36
..   B ø⇠◔ B'
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    37
..     | |
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    38
..   A ● |
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    39
..     |/
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    40
..     ●
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    41
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    42
  $ . $TESTDIR/testlib/push-checkheads-util.sh
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    43
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    44
  $ cat >> $HGRCPATH << EOF
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    45
  > [command-templates]
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    46
  > log = "{node|short} [{branch}] ({phase}): {desc}\n"
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    47
  > EOF
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    48
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    49
Test setup
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    50
----------
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    51
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    52
  $ mkdir A2
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    53
  $ cd A2
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    54
  $ setuprepos single-head
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    55
  creating basic server and client repo
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    56
  updating to branch default
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    57
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    58
  $ cd client
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    59
  $ mkcommit B0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    60
  $ hg branch Z
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    61
  marked working directory as branch Z
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    62
  (branches are permanent and global, did you want a bookmark?)
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    63
  $ mkcommit C0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    64
  $ mkcommit D0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    65
  $ hg push --new-branch
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    66
  pushing to $TESTTMP/A2/server
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    67
  searching for changes
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    68
  adding changesets
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    69
  adding manifests
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    70
  adding file changes
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    71
  added 3 changesets with 3 changes to 3 files
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    72
  $ hg up 0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    73
  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    74
  $ mkcommit B1
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    75
  created new head
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    76
  $ hg debugobsolete `getid "desc(B0)"` `getid "desc(B1)"`
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    77
  1 new obsolescence markers
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    78
  obsoleted 1 changesets
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    79
  2 new orphan changesets
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    80
  $ hg heads
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    81
  25c56d33e4c4 [default] (draft): B1
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    82
  cdf1dbb37a67 [Z] (draft): D0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    83
  8aaa48160adc [default] (draft): A0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    84
  $ hg log -G --hidden
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    85
  @  25c56d33e4c4 [default] (draft): B1
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    86
  |
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    87
  | *  cdf1dbb37a67 [Z] (draft): D0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    88
  | |
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    89
  | *  3213e3e16c67 [Z] (draft): C0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    90
  | |
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    91
  | x  d73caddc5533 [default] (draft): B0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    92
  | |
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    93
  | o  8aaa48160adc [default] (draft): A0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    94
  |/
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    95
  o  1e4be0697311 [default] (public): root
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    96
  
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    97
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    98
Actual testing
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    99
--------------
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   100
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   101
(force push to make sure we get the changeset on the remote)
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   102
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   103
  $ hg push -r 'desc("B1")' --force
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   104
  pushing to $TESTTMP/A2/server
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   105
  searching for changes
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   106
  adding changesets
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   107
  adding manifests
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   108
  adding file changes
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   109
  transaction abort!
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   110
  rollback completed
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   111
  abort: rejecting multiple heads on branch "default"
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   112
  (2 heads: 8aaa48160adc 25c56d33e4c4)
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   113
  [255]