comparison tests/test-topic-push-concurrent-on.t @ 2674:9585fac76d2d

topic: adjust head checking wrapping to not interfere with concurrent push In the previous form, the new topic head was detected as affected and the push was rejected. We introduce a of 'test-topic-push.t' using the new race checker as there have been many compatibility issue with this new checkers.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 28 Jun 2017 18:18:59 +0200
parents tests/test-topic-push.t@800463d6478c
children 167567795f6c 06844693bb21
comparison
equal deleted inserted replaced
2673:1014341c637b 2674:9585fac76d2d
1 # same as test-topic-push but with the concurrent push feature on
2
3 $ . "$TESTDIR/testlib/topic_setup.sh"
4
5 $ cat << EOF >> $HGRCPATH
6 > [ui]
7 > logtemplate = {rev} {branch} {get(namespaces, "topics")} {phase} {desc|firstline}\n
8 > ssh =python "$RUNTESTDIR/dummyssh"
9 > [server]
10 > concurrent-push-mode=check-related
11 > EOF
12
13 $ hg init main
14 $ hg init draft
15 $ cat << EOF >> draft/.hg/hgrc
16 > [phases]
17 > publish=False
18 > EOF
19 $ hg clone main client
20 updating to branch default
21 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
22 $ cat << EOF >> client/.hg/hgrc
23 > [paths]
24 > draft=../draft
25 > EOF
26
27
28 Testing core behavior to make sure we did not break anything
29 ============================================================
30
31 Pushing a first changeset
32
33 $ cd client
34 $ echo aaa > aaa
35 $ hg add aaa
36 $ hg commit -m 'CA'
37 $ hg outgoing -G
38 comparing with $TESTTMP/main (glob)
39 searching for changes
40 @ 0 default draft CA
41
42 $ hg push
43 pushing to $TESTTMP/main (glob)
44 searching for changes
45 adding changesets
46 adding manifests
47 adding file changes
48 added 1 changesets with 1 changes to 1 files
49
50 Pushing two heads
51
52 $ echo aaa > bbb
53 $ hg add bbb
54 $ hg commit -m 'CB'
55 $ echo aaa > ccc
56 $ hg up 'desc(CA)'
57 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
58 $ hg add ccc
59 $ hg commit -m 'CC'
60 created new head
61 $ hg outgoing -G
62 comparing with $TESTTMP/main (glob)
63 searching for changes
64 @ 2 default draft CC
65
66 o 1 default draft CB
67
68 $ hg push
69 pushing to $TESTTMP/main (glob)
70 searching for changes
71 abort: push creates new remote head 9fe81b7f425d!
72 (merge or see 'hg help push' for details about pushing new heads)
73 [255]
74 $ hg outgoing -r 'desc(CB)' -G
75 comparing with $TESTTMP/main (glob)
76 searching for changes
77 o 1 default draft CB
78
79 $ hg push -r 'desc(CB)'
80 pushing to $TESTTMP/main (glob)
81 searching for changes
82 adding changesets
83 adding manifests
84 adding file changes
85 added 1 changesets with 1 changes to 1 files
86
87 Pushing a new branch
88
89 $ hg branch mountain
90 marked working directory as branch mountain
91 (branches are permanent and global, did you want a bookmark?)
92 $ hg commit --amend
93 $ hg outgoing -G
94 comparing with $TESTTMP/main (glob)
95 searching for changes
96 @ 4 mountain draft CC
97
98 $ hg push
99 pushing to $TESTTMP/main (glob)
100 searching for changes
101 abort: push creates new remote branches: mountain!
102 (use 'hg push --new-branch' to create new remote branches)
103 [255]
104 $ hg push --new-branch
105 pushing to $TESTTMP/main (glob)
106 searching for changes
107 adding changesets
108 adding manifests
109 adding file changes
110 added 1 changesets with 1 changes to 1 files (+1 heads)
111 2 new obsolescence markers
112
113 Including on non-publishing
114
115 $ hg push --new-branch draft
116 pushing to $TESTTMP/draft (glob)
117 searching for changes
118 adding changesets
119 adding manifests
120 adding file changes
121 added 3 changesets with 3 changes to 3 files (+1 heads)
122 2 new obsolescence markers
123
124 Testing topic behavior
125 ======================
126
127 Local peer tests
128 ----------------
129
130 $ hg up -r 'desc(CA)'
131 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
132 $ hg topic babar
133 $ echo aaa > ddd
134 $ hg add ddd
135 $ hg commit -m 'CD'
136 $ hg log -G # keep track of phase because I saw some strange bug during developement
137 @ 5 default babar draft CD
138 |
139 | o 4 mountain public CC
140 |/
141 | o 1 default public CB
142 |/
143 o 0 default public CA
144
145
146 Pushing a new topic to a non publishing server should not be seen as a new head
147
148 $ hg push draft
149 pushing to $TESTTMP/draft (glob)
150 searching for changes
151 adding changesets
152 adding manifests
153 adding file changes
154 added 1 changesets with 1 changes to 1 files (+1 heads)
155 $ hg log -G
156 @ 5 default babar draft CD
157 |
158 | o 4 mountain public CC
159 |/
160 | o 1 default public CB
161 |/
162 o 0 default public CA
163
164
165 Pushing a new topic to a publishing server should be seen as a new head
166
167 $ hg push
168 pushing to $TESTTMP/main (glob)
169 searching for changes
170 abort: push creates new remote head 67f579af159d!
171 (merge or see 'hg help push' for details about pushing new heads)
172 [255]
173 $ hg log -G
174 @ 5 default babar draft CD
175 |
176 | o 4 mountain public CC
177 |/
178 | o 1 default public CB
179 |/
180 o 0 default public CA
181
182
183 wireprotocol tests
184 ------------------
185
186 $ hg up -r 'desc(CA)'
187 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
188 $ hg topic celeste
189 $ echo aaa > eee
190 $ hg add eee
191 $ hg commit -m 'CE'
192 $ hg log -G # keep track of phase because I saw some strange bug during developement
193 @ 6 default celeste draft CE
194 |
195 | o 5 default babar draft CD
196 |/
197 | o 4 mountain public CC
198 |/
199 | o 1 default public CB
200 |/
201 o 0 default public CA
202
203
204 Pushing a new topic to a non publishing server without topic -> new head
205
206 $ cat << EOF >> ../draft/.hg/hgrc
207 > [extensions]
208 > topic=!
209 > EOF
210 $ hg push ssh://user@dummy/draft
211 pushing to ssh://user@dummy/draft
212 searching for changes
213 abort: push creates new remote head 84eaf32db6c3!
214 (merge or see 'hg help push' for details about pushing new heads)
215 [255]
216 $ hg log -G
217 @ 6 default celeste draft CE
218 |
219 | o 5 default babar draft CD
220 |/
221 | o 4 mountain public CC
222 |/
223 | o 1 default public CB
224 |/
225 o 0 default public CA
226
227
228 Pushing a new topic to a non publishing server should not be seen as a new head
229
230 $ printf "topic=" >> ../draft/.hg/hgrc
231 $ hg config extensions.topic >> ../draft/.hg/hgrc
232 $ hg push ssh://user@dummy/draft
233 pushing to ssh://user@dummy/draft
234 searching for changes
235 remote: adding changesets
236 remote: adding manifests
237 remote: adding file changes
238 remote: added 1 changesets with 1 changes to 1 files (+1 heads)
239 $ hg log -G
240 @ 6 default celeste draft CE
241 |
242 | o 5 default babar draft CD
243 |/
244 | o 4 mountain public CC
245 |/
246 | o 1 default public CB
247 |/
248 o 0 default public CA
249
250
251 Pushing a new topic to a publishing server should be seen as a new head
252
253 $ hg push ssh://user@dummy/main
254 pushing to ssh://user@dummy/main
255 searching for changes
256 abort: push creates new remote head 67f579af159d!
257 (merge or see 'hg help push' for details about pushing new heads)
258 [255]
259 $ hg log -G
260 @ 6 default celeste draft CE
261 |
262 | o 5 default babar draft CD
263 |/
264 | o 4 mountain public CC
265 |/
266 | o 1 default public CB
267 |/
268 o 0 default public CA
269
270
271 Check that we reject multiple head on the same topic
272 ----------------------------------------------------
273
274 $ hg up 'desc(CB)'
275 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
276 $ hg topic babar
277 $ echo aaa > fff
278 $ hg add fff
279 $ hg commit -m 'CF'
280 $ hg log -G
281 @ 7 default babar draft CF
282 |
283 | o 6 default celeste draft CE
284 | |
285 | | o 5 default babar draft CD
286 | |/
287 | | o 4 mountain public CC
288 | |/
289 o | 1 default public CB
290 |/
291 o 0 default public CA
292
293
294 $ hg push draft
295 pushing to $TESTTMP/draft (glob)
296 searching for changes
297 abort: push creates new remote head f0bc62a661be on branch 'default:babar'!
298 (merge or see 'hg help push' for details about pushing new heads)
299 [255]
300
301 Multiple head on a branch merged in a topic changesets
302 ------------------------------------------------------------------------
303
304
305 $ hg up 'desc(CA)'
306 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
307 $ echo aaa > ggg
308 $ hg add ggg
309 $ hg commit -m 'CG'
310 created new head
311 $ hg up 'desc(CF)'
312 switching to topic babar
313 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
314 $ hg merge 'desc(CG)'
315 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
316 (branch merge, don't forget to commit)
317 $ hg commit -m 'CM'
318 $ hg log -G
319 @ 9 default babar draft CM
320 |\
321 | o 8 default draft CG
322 | |
323 o | 7 default babar draft CF
324 | |
325 | | o 6 default celeste draft CE
326 | |/
327 | | o 5 default babar draft CD
328 | |/
329 | | o 4 mountain public CC
330 | |/
331 o | 1 default public CB
332 |/
333 o 0 default public CA
334
335
336 Reject when pushing to draft
337
338 $ hg push draft -r .
339 pushing to $TESTTMP/draft (glob)
340 searching for changes
341 abort: push creates new remote head 4937c4cad39e!
342 (merge or see 'hg help push' for details about pushing new heads)
343 [255]
344
345
346 Reject when pushing to publishing
347
348 $ hg push -r .
349 pushing to $TESTTMP/main (glob)
350 searching for changes
351 adding changesets
352 adding manifests
353 adding file changes
354 added 3 changesets with 2 changes to 2 files
355
356 $ cd ..
357
358 Test phase move
359 ==================================
360
361 setup, two repo knowns about two small topic branch
362
363 $ hg init repoA
364 $ hg clone repoA repoB
365 updating to branch default
366 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
367 $ cat << EOF >> repoA/.hg/hgrc
368 > [phases]
369 > publish=False
370 > EOF
371 $ cat << EOF >> repoB/.hg/hgrc
372 > [phases]
373 > publish=False
374 > EOF
375 $ cd repoA
376 $ echo aaa > base
377 $ hg add base
378 $ hg commit -m 'CBASE'
379 $ echo aaa > aaa
380 $ hg add aaa
381 $ hg topic topicA
382 $ hg commit -m 'CA'
383 $ hg up 'desc(CBASE)'
384 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
385 $ echo aaa > bbb
386 $ hg add bbb
387 $ hg topic topicB
388 $ hg commit -m 'CB'
389 $ cd ..
390 $ hg push -R repoA repoB
391 pushing to repoB
392 searching for changes
393 adding changesets
394 adding manifests
395 adding file changes
396 added 3 changesets with 3 changes to 3 files (+1 heads)
397 $ hg log -G -R repoA
398 @ 2 default topicB draft CB
399 |
400 | o 1 default topicA draft CA
401 |/
402 o 0 default draft CBASE
403
404
405 We turn different topic to public on each side,
406
407 $ hg -R repoA phase --public topicA
408 $ hg -R repoB phase --public topicB
409
410 Pushing should complain because it create to heads on default
411
412 $ hg push -R repoA repoB
413 pushing to repoB
414 searching for changes
415 no changes found
416 abort: push create a new head on branch "default"
417 [255]