tests/test-single-head-obsolescence-named-branch-A1.t
author Raphaël Gomès <rgomes@octobus.net>
Tue, 12 Apr 2022 16:24:25 +0200
changeset 49139 7241b3721ba5
parent 48688 053a5bf508da
permissions -rw-r--r--
rust-dirstatemap: stop using `.state` in `is_from_other_parent` This is a deprecated API and will be removed one day. Differential Revision: https://phab.mercurial-scm.org/D12537
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-1
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 1: A fully obsolete branch kept visible by another one
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
.. * 2 changesets on branch default superseding the other ones
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    24
..
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    25
.. expected-result:
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    26
..
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    27
.. * only one head detected
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    28
..
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    29
.. graph-summary:
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    30
..
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    31
..   D ●      (branch Z)
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    32
..     |
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    33
..   C ●      (branch Z)
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    34
..     |
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    35
..   B ø⇠◔ B'
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    36
..     | |
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    37
..   A ø⇠◔ A'
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    38
..     |/
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
  $ . $TESTDIR/testlib/push-checkheads-util.sh
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    42
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    43
  $ cat >> $HGRCPATH << EOF
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    44
  > [command-templates]
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    45
  > log = "{node|short} [{branch}] ({phase}): {desc}\n"
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    46
  > EOF
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    47
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    48
Test setup
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    49
----------
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
  $ mkdir A1
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    52
  $ cd A1
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    53
  $ setuprepos single-head
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    54
  creating basic server and client repo
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    55
  updating to branch default
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    56
  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
    57
  $ cd client
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    58
  $ mkcommit B0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    59
  $ hg branch Z
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    60
  marked working directory as branch Z
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    61
  (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
    62
  $ mkcommit C0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    63
  $ mkcommit D0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    64
  $ hg push --new-branch
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    65
  pushing to $TESTTMP/A1/server
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    66
  searching for changes
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    67
  adding changesets
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    68
  adding manifests
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    69
  adding file changes
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    70
  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
    71
  $ hg up 0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    72
  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
    73
  $ mkcommit A1
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    74
  created new head
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    75
  $ mkcommit B1
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    76
  $ hg debugobsolete `getid "desc(A0)"` `getid "desc(A1)"`
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
  3 new orphan changesets
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    80
  $ 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
    81
  1 new obsolescence markers
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    82
  obsoleted 1 changesets
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    83
  $ hg heads
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    84
  262c8c798096 [default] (draft): B1
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    85
  cdf1dbb37a67 [Z] (draft): D0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    86
  $ hg log -G --hidden
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    87
  @  262c8c798096 [default] (draft): B1
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
  o  f6082bc4ffef [default] (draft): A1
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
  | *  cdf1dbb37a67 [Z] (draft): D0
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
  | *  3213e3e16c67 [Z] (draft): C0
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
  | x  d73caddc5533 [default] (draft): B0
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
  | x  8aaa48160adc [default] (draft): A0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    98
  |/
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    99
  o  1e4be0697311 [default] (public): root
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
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   102
Actual testing
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   103
--------------
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   104
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   105
  $ hg push -r 'desc("B1")'
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   106
  pushing to $TESTTMP/A1/server
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   107
  searching for changes
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   108
  adding changesets
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   109
  adding manifests
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   110
  adding file changes
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   111
  added 2 changesets with 2 changes to 2 files (+1 heads)
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   112
  2 new obsolescence markers
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   113
  obsoleted 2 changesets
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   114
  2 new orphan changesets