|
1 ========================================= |
|
2 Testing single head enforcement: Case A-5 |
|
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 5: Obsoleting a merge reveals two heads |
|
14 |
|
15 .. old-state: |
|
16 .. |
|
17 .. * 3 changesets 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 changesets 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 .. C ● (branch Z) |
|
32 .. | |
|
33 .. M ⊗ |
|
34 .. |\ |
|
35 .. A ● ● B |
|
36 .. |/ |
|
37 .. ● |
|
38 |
|
39 $ . $TESTDIR/testlib/push-checkheads-util.sh |
|
40 |
|
41 $ cat >> $HGRCPATH << EOF |
|
42 > [command-templates] |
|
43 > log = "{node|short} [{branch}] ({phase}): {desc}\n" |
|
44 > EOF |
|
45 |
|
46 Test setup |
|
47 ---------- |
|
48 |
|
49 $ mkdir A5 |
|
50 $ cd A5 |
|
51 $ setuprepos single-head |
|
52 creating basic server and client repo |
|
53 updating to branch default |
|
54 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
55 $ cd client |
|
56 $ hg up 0 |
|
57 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
58 $ mkcommit B0 |
|
59 created new head |
|
60 $ hg merge |
|
61 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
62 (branch merge, don't forget to commit) |
|
63 $ hg ci -m 'M0' |
|
64 $ hg branch Z |
|
65 marked working directory as branch Z |
|
66 (branches are permanent and global, did you want a bookmark?) |
|
67 $ mkcommit C0 |
|
68 $ hg push --new-branch |
|
69 pushing to $TESTTMP/A5/server |
|
70 searching for changes |
|
71 adding changesets |
|
72 adding manifests |
|
73 adding file changes |
|
74 added 3 changesets with 2 changes to 2 files |
|
75 $ hg debugobsolete `getid "desc(M0)"` --record-parents |
|
76 1 new obsolescence markers |
|
77 obsoleted 1 changesets |
|
78 1 new orphan changesets |
|
79 $ hg heads |
|
80 61c95483cc12 [Z] (draft): C0 |
|
81 74ff5441d343 [default] (draft): B0 |
|
82 8aaa48160adc [default] (draft): A0 |
|
83 $ hg log -G --hidden |
|
84 @ 61c95483cc12 [Z] (draft): C0 |
|
85 | |
|
86 x 14d3d4d41d1a [default] (draft): M0 |
|
87 |\ |
|
88 | o 74ff5441d343 [default] (draft): B0 |
|
89 | | |
|
90 o | 8aaa48160adc [default] (draft): A0 |
|
91 |/ |
|
92 o 1e4be0697311 [default] (public): root |
|
93 |
|
94 |
|
95 Actual testing |
|
96 -------------- |
|
97 |
|
98 (force push to make sure we get the changeset on the remote) |
|
99 |
|
100 $ hg push -r 'desc("C0")' --force |
|
101 pushing to $TESTTMP/A5/server |
|
102 searching for changes |
|
103 no changes found |
|
104 transaction abort! |
|
105 rollback completed |
|
106 abort: rejecting multiple heads on branch "default" |
|
107 (2 heads: 8aaa48160adc 74ff5441d343) |
|
108 [255] |