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