Debian Codegraph @

tests/test-obsolete-check-push.t

raw
1 =======================================================
2 Test check for obsolescence and instability during push
3 =======================================================
4
5 $ . $TESTDIR/testlib/obsmarker-common.sh
6
7 $ cat >> $HGRCPATH << EOF
8 > [phases]
9 > publish=false
10 > [experimental]
11 > evolution = all
12 > EOF
13
14
15 Tests that pushing orphaness to the server is detected
16 ======================================================
17
18 initial setup
19
20 $ mkdir base
21 $ cd base
22 $ hg init server
23 $ cd server
24 $ mkcommit root
25 $ hg phase --public .
26 $ mkcommit commit_A0_
27 $ mkcommit commit_B0_
28 $ cd ..
29 $ hg init client
30 $ cd client
31 $ echo '[paths]' >> .hg/hgrc
32 $ echo 'default=../server' >> .hg/hgrc
33 $ hg pull
34 pulling from $TESTTMP/base/server
35 requesting all changes
36 adding changesets
37 adding manifests
38 adding file changes
39 added 3 changesets with 3 changes to 3 files
40 new changesets 1e4be0697311:c09d8ab29fda (2 drafts)
41 (run 'hg update' to get a working copy)
42 $ hg up 'desc("root")'
43 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
44 (having some unrelated change affects discovery result, we should ideally test both case)
45 $ hg branch unrelated --quiet
46 $ mkcommit unrelated
47 $ hg up null
48 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
49 $ hg log -G
50 o changeset: 3:16affbe0f986
51 | branch: unrelated
52 | tag: tip
53 | parent: 0:1e4be0697311
54 | user: test
55 | date: Thu Jan 01 00:00:00 1970 +0000
56 | summary: unrelated
57 |
58 | o changeset: 2:c09d8ab29fda
59 | | user: test
60 | | date: Thu Jan 01 00:00:00 1970 +0000
61 | | summary: commit_B0_
62 | |
63 | o changeset: 1:37624bf21024
64 |/ user: test
65 | date: Thu Jan 01 00:00:00 1970 +0000
66 | summary: commit_A0_
67 |
68 o changeset: 0:1e4be0697311
69 user: test
70 date: Thu Jan 01 00:00:00 1970 +0000
71 summary: root
72
73 $ cd ..
74 $ cd ..
75
76
77 Orphan from pruning
78 -------------------
79
80 Setup
81
82 $ cp -R base check-pruned
83 $ cd check-pruned/client
84 $ hg debugobsolete --record-parents `getid 'desc("commit_A0_")'`
85 1 new obsolescence markers
86 obsoleted 1 changesets
87 1 new orphan changesets
88 $ hg log -G
89 o changeset: 3:16affbe0f986
90 | branch: unrelated
91 | tag: tip
92 | parent: 0:1e4be0697311
93 | user: test
94 | date: Thu Jan 01 00:00:00 1970 +0000
95 | summary: unrelated
96 |
97 | * changeset: 2:c09d8ab29fda
98 | | user: test
99 | | date: Thu Jan 01 00:00:00 1970 +0000
100 | | instability: orphan
101 | | summary: commit_B0_
102 | |
103 | x changeset: 1:37624bf21024
104 |/ user: test
105 | date: Thu Jan 01 00:00:00 1970 +0000
106 | obsolete: pruned
107 | summary: commit_A0_
108 |
109 o changeset: 0:1e4be0697311
110 user: test
111 date: Thu Jan 01 00:00:00 1970 +0000
112 summary: root
113
114
115 Pushing the result is prevented with a message
116
117 $ hg push --new-branch
118 pushing to $TESTTMP/check-pruned/server
119 searching for changes
120 abort: push includes orphan changeset: c09d8ab29fda!
121 [255]
122
123 $ cd ../..
124
125
126 Orphan from superseding
127 -----------------------
128
129 Setup
130
131 $ cp -R base check-superseded
132 $ cd check-superseded/client
133 $ hg up 'desc("commit_A0_")'
134 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
135 $ hg branch other
136 marked working directory as branch other
137 $ hg commit --amend -m commit_A1_
138 1 new orphan changesets
139 $ hg log -G
140 @ changeset: 4:df9b82a99e21
141 | branch: other
142 | tag: tip
143 | parent: 0:1e4be0697311
144 | user: test
145 | date: Thu Jan 01 00:00:00 1970 +0000
146 | summary: commit_A1_
147 |
148 | o changeset: 3:16affbe0f986
149 |/ branch: unrelated
150 | parent: 0:1e4be0697311
151 | user: test
152 | date: Thu Jan 01 00:00:00 1970 +0000
153 | summary: unrelated
154 |
155 | * changeset: 2:c09d8ab29fda
156 | | user: test
157 | | date: Thu Jan 01 00:00:00 1970 +0000
158 | | instability: orphan
159 | | summary: commit_B0_
160 | |
161 | x changeset: 1:37624bf21024
162 |/ user: test
163 | date: Thu Jan 01 00:00:00 1970 +0000
164 | obsolete: rewritten using amend as 4:df9b82a99e21
165 | summary: commit_A0_
166 |
167 o changeset: 0:1e4be0697311
168 user: test
169 date: Thu Jan 01 00:00:00 1970 +0000
170 summary: root
171
172
173 Pushing the result is prevented with a message
174
175 $ hg push --new-branch
176 pushing to $TESTTMP/check-superseded/server
177 searching for changes
178 abort: push includes orphan changeset: c09d8ab29fda!
179 [255]
180
181 $ cd ../..
182
183 Tests that user get warned if it is about to publish obsolete/unstable content
184 ------------------------------------------------------------------------------
185
186 Orphan from pruning
187 -------------------
188
189 Make sure the only difference is phase:
190
191 $ cd check-pruned/client
192 $ hg push --force --rev 'not desc("unrelated")'
193 pushing to $TESTTMP/check-pruned/server
194 searching for changes
195 no changes found
196 1 new obsolescence markers
197 obsoleted 1 changesets
198 1 new orphan changesets
199 [1]
200
201 Check something prevents a silent publication of the obsolete changeset
202
203 $ hg push --publish --new-branch
204 pushing to $TESTTMP/check-pruned/server
205 searching for changes
206 abort: push includes orphan changeset: c09d8ab29fda!
207 [255]
208
209 $ cd ../..
210
211 Orphan from superseding
212 -----------------------
213
214 Make sure the only difference is phase:
215
216 $ cd check-superseded/client
217 $ hg push --force --rev 'not desc("unrelated")'
218 pushing to $TESTTMP/check-superseded/server
219 searching for changes
220 adding changesets
221 adding manifests
222 adding file changes
223 added 1 changesets with 0 changes to 0 files (+1 heads)
224 1 new obsolescence markers
225 obsoleted 1 changesets
226 1 new orphan changesets
227
228 Check something prevents a silent publication of the obsolete changeset
229
230 $ hg push --publish --new-branch
231 pushing to $TESTTMP/check-superseded/server
232 searching for changes
233 abort: push includes orphan changeset: c09d8ab29fda!
234 [255]
235
236 $ cd ../..