|
1 ========================================= |
|
2 Testing single head enforcement: Case A-4 |
|
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 4: Partial rewrite of a branch to deinterleave it |
|
14 |
|
15 .. old-state: |
|
16 .. |
|
17 .. * 2 changesets on branch default |
|
18 .. * 2 changesets on branch Z interleaved with the other one |
|
19 .. |
|
20 .. new-state: |
|
21 .. |
|
22 .. * 2 changesets on branch Z at the same location |
|
23 .. * 1 changeset on default untouched (the lower one) |
|
24 .. * 1 changeset on default moved on the other one |
|
25 .. |
|
26 .. expected-result: |
|
27 .. |
|
28 .. * only one head detected |
|
29 .. |
|
30 .. graph-summary: |
|
31 .. |
|
32 .. D ● (branch Z) |
|
33 .. | |
|
34 .. C ø⇠◔ C' |
|
35 .. | | |
|
36 .. B ● | (branch Z) |
|
37 .. |/ |
|
38 .. A ● |
|
39 .. | |
|
40 .. ● |
|
41 |
|
42 $ . $TESTDIR/testlib/push-checkheads-util.sh |
|
43 |
|
44 $ cat >> $HGRCPATH << EOF |
|
45 > [command-templates] |
|
46 > log = "{node|short} [{branch}] ({phase}): {desc}\n" |
|
47 > EOF |
|
48 |
|
49 Test setup |
|
50 ---------- |
|
51 |
|
52 $ mkdir A4 |
|
53 $ cd A4 |
|
54 $ setuprepos single-head |
|
55 creating basic server and client repo |
|
56 updating to branch default |
|
57 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
58 $ cd client |
|
59 $ hg branch Z |
|
60 marked working directory as branch Z |
|
61 (branches are permanent and global, did you want a bookmark?) |
|
62 $ mkcommit B0 |
|
63 $ hg branch default --force |
|
64 marked working directory as branch default |
|
65 $ mkcommit C0 |
|
66 created new head |
|
67 $ hg branch Z --force |
|
68 marked working directory as branch Z |
|
69 $ mkcommit D0 |
|
70 created new head |
|
71 $ hg push --new-branch |
|
72 pushing to $TESTTMP/A4/server |
|
73 searching for changes |
|
74 adding changesets |
|
75 adding manifests |
|
76 adding file changes |
|
77 added 3 changesets with 3 changes to 3 files |
|
78 $ hg up 'desc("A0")' |
|
79 0 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
80 $ mkcommit C1 |
|
81 created new head |
|
82 $ hg debugobsolete `getid "desc(C0)"` `getid "desc(C1)"` |
|
83 1 new obsolescence markers |
|
84 obsoleted 1 changesets |
|
85 1 new orphan changesets |
|
86 $ hg heads |
|
87 cfe9ed94fa4a [default] (draft): C1 |
|
88 78578c4306ce [Z] (draft): D0 |
|
89 $ hg log -G --hidden |
|
90 @ cfe9ed94fa4a [default] (draft): C1 |
|
91 | |
|
92 | * 78578c4306ce [Z] (draft): D0 |
|
93 | | |
|
94 | x afc55ba2ce61 [default] (draft): C0 |
|
95 | | |
|
96 | o 93e5c1321ece [Z] (draft): B0 |
|
97 |/ |
|
98 o 8aaa48160adc [default] (draft): A0 |
|
99 | |
|
100 o 1e4be0697311 [default] (public): root |
|
101 |
|
102 |
|
103 Actual testing |
|
104 -------------- |
|
105 |
|
106 (force push to make sure we get the changeset on the remote) |
|
107 |
|
108 $ hg push -r 'desc("C1")' --force |
|
109 pushing to $TESTTMP/A4/server |
|
110 searching for changes |
|
111 adding changesets |
|
112 adding manifests |
|
113 adding file changes |
|
114 added 1 changesets with 1 changes to 1 files (+1 heads) |
|
115 1 new obsolescence markers |
|
116 obsoleted 1 changesets |
|
117 1 new orphan changesets |