|
1 |
|
2 ========================================= |
|
3 Testing single head enforcement: Case A-2 |
|
4 ========================================= |
|
5 |
|
6 A repository is set to only accept a single head per name (typically named |
|
7 branch). However, obsolete changesets can make this enforcement more |
|
8 complicated, because they can be kept visible by other changeset on other |
|
9 branch. |
|
10 |
|
11 This case is part of a series of tests checking this behavior. |
|
12 |
|
13 Category A: Involving obsolescence |
|
14 TestCase 2: A branch is split in two, effectively creating two heads |
|
15 |
|
16 .. old-state: |
|
17 .. |
|
18 .. * 2 changeset changeset on branch default |
|
19 .. * 2 changeset changeset on branch Z on top of them. |
|
20 .. |
|
21 .. new-state: |
|
22 .. |
|
23 .. * 2 changeset changeset on branch Z at the same location |
|
24 .. * 1 changeset changeset on branch default unchanged |
|
25 .. * 1 changeset changeset on branch default superceeding the other ones |
|
26 .. |
|
27 .. expected-result: |
|
28 .. |
|
29 .. * two heads detected |
|
30 .. |
|
31 .. graph-summary: |
|
32 .. |
|
33 .. D ● (branch Z) |
|
34 .. | |
|
35 .. C ● (branch Z) |
|
36 .. | |
|
37 .. B ø⇠◔ B' |
|
38 .. | | |
|
39 .. A ● | |
|
40 .. |/ |
|
41 .. ● |
|
42 |
|
43 $ . $TESTDIR/testlib/topic_setup.sh |
|
44 $ . $TESTDIR/testlib/push-checkheads-util.sh |
|
45 |
|
46 Test setup |
|
47 ---------- |
|
48 |
|
49 $ mkdir A2 |
|
50 $ cd A2 |
|
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 $ mkcommit B0 |
|
57 $ hg branch Z |
|
58 marked working directory as branch Z |
|
59 (branches are permanent and global, did you want a bookmark?) |
|
60 $ mkcommit C0 |
|
61 $ mkcommit D0 |
|
62 $ hg push --new-branch |
|
63 pushing to $TESTTMP/A2/server |
|
64 searching for changes |
|
65 adding changesets |
|
66 adding manifests |
|
67 adding file changes |
|
68 added 3 changesets with 3 changes to 3 files |
|
69 $ hg up 0 |
|
70 0 files updated, 0 files merged, 4 files removed, 0 files unresolved |
|
71 $ mkcommit B1 |
|
72 created new head |
|
73 (consider using topic for lightweight branches. See 'hg help topic') |
|
74 $ hg debugobsolete `getid "desc(B0)" ` `getid "desc(B1)"` |
|
75 1 new obsolescence markers |
|
76 obsoleted 1 changesets |
|
77 2 new orphan changesets |
|
78 $ hg log -G --hidden |
|
79 @ 25c56d33e4c4 [default] (draft): B1 |
|
80 | |
|
81 | * cdf1dbb37a67 [Z] (draft): D0 |
|
82 | | |
|
83 | * 3213e3e16c67 [Z] (draft): C0 |
|
84 | | |
|
85 | x d73caddc5533 [default] (draft): B0 |
|
86 | | |
|
87 | o 8aaa48160adc [default] (draft): A0 |
|
88 |/ |
|
89 o 1e4be0697311 [default] (public): root |
|
90 |
|
91 |
|
92 Actual testing |
|
93 -------------- |
|
94 |
|
95 (force push to make sure we get the changeset on the remote) |
|
96 |
|
97 $ hg push -r 'desc("B1")' --force |
|
98 pushing to $TESTTMP/A2/server |
|
99 searching for changes |
|
100 adding changesets |
|
101 adding manifests |
|
102 adding file changes |
|
103 transaction abort! |
|
104 rollback completed |
|
105 abort: rejecting multiple heads on branch "default" |
|
106 (2 heads: 8aaa48160adc 25c56d33e4c4) |
|
107 [255] |