tests/test-single-head-obsolescence-named-branch-A4.t
author Luke Granger-Brown <hg@lukegb.com>
Mon, 14 Mar 2022 14:10:41 +0000
branchstable
changeset 48962 59be65b7cdfd
parent 48688 053a5bf508da
permissions -rw-r--r--
rust-hg-core: use correct type for libc hostname buffer The type of libc::c_char is u8 on aarch64 rather than i8, which causes the use of a specifically-typed constant to fail. Differential Revision: https://phab.mercurial-scm.org/D12373
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-4
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 4: Partial rewrite of a branch to deinterleave it
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 interleaved with the other one
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 default untouched (the lower one)
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    24
.. * 1 changeset on default moved on the other one
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
.. * only one head 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 ø⇠◔ C'
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 ● |    (branch Z)
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 A4
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    53
  $ cd A4
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
  $ 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 B0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    63
  $ hg branch default --force
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    64
  marked working directory as branch default
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    65
  $ mkcommit C0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    66
  created new head
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    67
  $ hg branch Z --force
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    68
  marked working directory as branch Z
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    69
  $ mkcommit D0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    70
  created new head
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    71
  $ hg push --new-branch
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    72
  pushing to $TESTTMP/A4/server
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    73
  searching for changes
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    74
  adding changesets
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    75
  adding manifests
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    76
  adding file changes
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    77
  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
    78
  $ hg up 'desc("A0")'
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    79
  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    80
  $ mkcommit C1
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    81
  created new head
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    82
  $ hg debugobsolete `getid "desc(C0)"` `getid "desc(C1)"`
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    83
  1 new obsolescence markers
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    84
  obsoleted 1 changesets
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    85
  1 new orphan changesets
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    86
  $ hg heads
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    87
  cfe9ed94fa4a [default] (draft): C1
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    88
  78578c4306ce [Z] (draft): D0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    89
  $ hg log -G --hidden
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    90
  @  cfe9ed94fa4a [default] (draft): C1
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    91
  |
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    92
  | *  78578c4306ce [Z] (draft): D0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    93
  | |
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    94
  | x  afc55ba2ce61 [default] (draft): C0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    95
  | |
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    96
  | o  93e5c1321ece [Z] (draft): B0
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
  o  8aaa48160adc [default] (draft): A0
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
  o  1e4be0697311 [default] (public): root
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
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   103
Actual testing
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
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   106
(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
   107
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   108
  $ hg push -r 'desc("C1")' --force
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   109
  pushing to $TESTTMP/A4/server
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   110
  searching for changes
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   111
  adding changesets
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   112
  adding manifests
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   113
  adding file changes
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   114
  added 1 changesets with 1 changes to 1 files (+1 heads)
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   115
  1 new obsolescence markers
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   116
  obsoleted 1 changesets
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   117
  1 new orphan changesets