comparison tests/test-single-head-obsolescence-named-branch-A5.t @ 5227:b20d04641c0f stable

head-checking: ignore obsolete section when checking for single heads This overwrite the core code that enforce single heads to ignore obsolete section. That way older obsolete version of a branch no longer prevent the new version to be pushed.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 11 Mar 2020 23:56:11 +0100
parents
children 35e769c9604f 8cc7732a29bf
comparison
equal deleted inserted replaced
5226:1e0516ee4cb9 5227:b20d04641c0f
1 =========================================
2 Testing single head enforcement: Case A-1
3 =========================================
4
5 A repository is set to only accept a single head per name (typically named
6 branch). However, obsolete changesets can make this enforcement more
7 complicated, because they can be kept visible by other changeset on other
8 branch.
9
10 This case is part of a series of tests checking this behavior.
11
12 Category A: Involving obsolescence
13 TestCase 1: obsoleting a merge reveal two heads
14
15 .. old-state:
16 ..
17 .. * 3 changeset changeset on branch default (2 on their own branch + 1 merge)
18 .. * 1 changeset on branch Z (children of the merge)
19 ..
20 .. new-state:
21 ..
22 .. * 2 changeset changeset on branch default (merge is obsolete) each a head
23 .. * 1 changeset on branch Z keeping the merge visible
24 ..
25 .. expected-result:
26 ..
27 .. * 2 heads detected (because we skip the merge).
28 ..
29 .. graph-summary:
30 ..
31 .. D ● (branch Z)
32 .. |
33 .. C ● (branch Z)
34 .. |
35 .. M ⊗
36 .. |\
37 .. A ● ● B
38 .. |/
39 .. ●
40
41 $ . $TESTDIR/testlib/topic_setup.sh
42 $ . $TESTDIR/testlib/push-checkheads-util.sh
43
44 Test setup
45 ----------
46
47 $ mkdir A5
48 $ cd A5
49 $ setuprepos single-head
50 creating basic server and client repo
51 updating to branch default
52 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
53 $ cd client
54 $ hg up 0
55 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
56 $ mkcommit B0
57 created new head
58 (consider using topic for lightweight branches. See 'hg help topic')
59 $ hg merge
60 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
61 (branch merge, don't forget to commit)
62 $ hg ci -m 'M0'
63 $ hg branch Z
64 marked working directory as branch Z
65 (branches are permanent and global, did you want a bookmark?)
66 $ mkcommit C0
67 $ hg push --new-branch
68 pushing to $TESTTMP/A5/server
69 searching for changes
70 adding changesets
71 adding manifests
72 adding file changes
73 added 3 changesets with 2 changes to 2 files
74 $ hg up 0
75 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
76 $ mkcommit A1
77 created new head
78 (consider using topic for lightweight branches. See 'hg help topic')
79 $ mkcommit B1
80 $ hg debugobsolete `getid "desc(M0)"` --record-parents
81 1 new obsolescence markers
82 obsoleted 1 changesets
83 1 new orphan changesets
84 $ hg log -G --hidden
85 @ 262c8c798096 [default] (draft): B1
86 |
87 o f6082bc4ffef [default] (draft): A1
88 |
89 | * 61c95483cc12 [Z] (draft): C0
90 | |
91 | x 14d3d4d41d1a [default] (draft): M0
92 | |\
93 +---o 74ff5441d343 [default] (draft): B0
94 | |
95 | o 8aaa48160adc [default] (draft): A0
96 |/
97 o 1e4be0697311 [default] (public): root
98
99
100 Actual testing
101 --------------
102
103 (force push to make sure we get the changeset on the remote)
104
105 $ hg push -r 'desc("C0")' --force
106 pushing to $TESTTMP/A5/server
107 searching for changes
108 no changes found
109 transaction abort!
110 rollback completed
111 abort: rejecting multiple heads on branch "default"
112 (2 heads: 8aaa48160adc 74ff5441d343)
113 [255]