tests/test-single-head-obsolescence-named-branch-A5.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Wed, 09 Nov 2022 13:54:15 -0500
branchstable
changeset 49789 df750b81272f
parent 48688 053a5bf508da
permissions -rw-r--r--
sqlitestore: add an `ancestors` method We will need it during bundling. The implementation mirror the one in revlog.
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-5
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 5: Obsoleting a merge reveals 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
.. * 3 changesets on branch default (2 on their own branch + 1 merge)
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    18
.. * 1 changeset on branch Z (children of the merge)
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 default (merge is obsolete) each a head
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    23
.. * 1 changeset on branch Z keeping the merge visible
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
.. * 2 heads detected (because we skip the merge)
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
..   C ●      (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
..   M ⊗
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
..   A ● ● 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
..     ●
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
  $ . $TESTDIR/testlib/push-checkheads-util.sh
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
  $ cat >> $HGRCPATH << EOF
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    42
  > [command-templates]
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    43
  > log = "{node|short} [{branch}] ({phase}): {desc}\n"
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    44
  > EOF
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    45
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    46
Test setup
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
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    49
  $ mkdir A5
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    50
  $ cd A5
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    51
  $ setuprepos single-head
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    52
  creating basic server and client repo
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    53
  updating to branch default
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    54
  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
    55
  $ cd client
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    56
  $ hg up 0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    57
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
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
  created new head
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    60
  $ hg merge
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    61
  1 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
    62
  (branch merge, don't forget to commit)
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    63
  $ hg ci -m 'M0'
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    64
  $ hg branch Z
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    65
  marked working directory as branch Z
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    66
  (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
    67
  $ mkcommit C0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    68
  $ hg push --new-branch
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    69
  pushing to $TESTTMP/A5/server
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    70
  searching for changes
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    71
  adding changesets
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    72
  adding manifests
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    73
  adding file changes
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    74
  added 3 changesets with 2 changes to 2 files
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    75
  $ hg debugobsolete `getid "desc(M0)"` --record-parents
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    76
  1 new obsolescence markers
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    77
  obsoleted 1 changesets
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    78
  1 new orphan changesets
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    79
  $ hg heads
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    80
  61c95483cc12 [Z] (draft): C0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    81
  74ff5441d343 [default] (draft): B0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    82
  8aaa48160adc [default] (draft): A0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    83
  $ hg log -G --hidden
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    84
  @  61c95483cc12 [Z] (draft): C0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    85
  |
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    86
  x    14d3d4d41d1a [default] (draft): M0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    87
  |\
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    88
  | o  74ff5441d343 [default] (draft): B0
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    89
  | |
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    90
  o |  8aaa48160adc [default] (draft): A0
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
  o  1e4be0697311 [default] (public): root
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
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    95
Actual testing
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
(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
    99
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   100
  $ hg push -r 'desc("C0")' --force
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   101
  pushing to $TESTTMP/A5/server
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   102
  searching for changes
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   103
  no changes found
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   104
  transaction abort!
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   105
  rollback completed
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   106
  abort: rejecting multiple heads on branch "default"
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   107
  (2 heads: 8aaa48160adc 74ff5441d343)
053a5bf508da discovery: port _postprocessobsolete() changes from evolve, add tests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   108
  [255]