Mercurial > hg
comparison tests/test-push-warn.t @ 12279:28e2e3804f2e
combine tests
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Tue, 14 Sep 2010 12:20:51 +0200 |
parents | tests/test-push-warn@4c94b6d0fb1c |
children | 4134686b83e1 |
comparison
equal
deleted
inserted
replaced
12278:c4c2ba553401 | 12279:28e2e3804f2e |
---|---|
1 $ echo "[extensions]" >> $HGRCPATH | |
2 $ echo "graphlog=" >> $HGRCPATH | |
3 | |
4 $ mkdir a | |
5 $ cd a | |
6 $ hg init | |
7 $ echo foo > t1 | |
8 $ hg add t1 | |
9 $ hg commit -m "1" | |
10 | |
11 $ cd .. | |
12 $ hg clone a b | |
13 updating to branch default | |
14 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
15 | |
16 $ cd a | |
17 $ echo foo > t2 | |
18 $ hg add t2 | |
19 $ hg commit -m "2" | |
20 | |
21 $ cd ../b | |
22 $ echo foo > t3 | |
23 $ hg add t3 | |
24 $ hg commit -m "3" | |
25 | |
26 $ hg push ../a | |
27 pushing to ../a | |
28 searching for changes | |
29 abort: push creates new remote heads on branch 'default'! | |
30 (you should pull and merge or use push -f to force) | |
31 | |
32 $ hg pull ../a | |
33 pulling from ../a | |
34 searching for changes | |
35 adding changesets | |
36 adding manifests | |
37 adding file changes | |
38 added 1 changesets with 1 changes to 1 files (+1 heads) | |
39 (run 'hg heads' to see heads, 'hg merge' to merge) | |
40 | |
41 $ hg push ../a | |
42 pushing to ../a | |
43 searching for changes | |
44 abort: push creates new remote heads on branch 'default'! | |
45 (did you forget to merge? use push -f to force) | |
46 | |
47 $ hg merge | |
48 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
49 (branch merge, don't forget to commit) | |
50 | |
51 $ hg commit -m "4" | |
52 $ hg push ../a | |
53 pushing to ../a | |
54 searching for changes | |
55 adding changesets | |
56 adding manifests | |
57 adding file changes | |
58 added 2 changesets with 1 changes to 1 files | |
59 | |
60 $ cd .. | |
61 | |
62 $ hg init c | |
63 $ cd c | |
64 $ for i in 0 1 2; do | |
65 > echo $i >> foo | |
66 > hg ci -Am $i | |
67 > done | |
68 adding foo | |
69 $ cd .. | |
70 | |
71 $ hg clone c d | |
72 updating to branch default | |
73 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
74 | |
75 $ cd d | |
76 $ for i in 0 1; do | |
77 > hg co -C $i | |
78 > echo d-$i >> foo | |
79 > hg ci -m d-$i | |
80 > done | |
81 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
82 created new head | |
83 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
84 created new head | |
85 | |
86 $ HGMERGE=true hg merge 3 | |
87 merging foo | |
88 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
89 (branch merge, don't forget to commit) | |
90 | |
91 $ hg ci -m c-d | |
92 | |
93 $ hg push ../c; echo $? | |
94 pushing to ../c | |
95 searching for changes | |
96 abort: push creates new remote heads on branch 'default'! | |
97 (did you forget to merge? use push -f to force) | |
98 255 | |
99 | |
100 $ hg push -r 2 ../c; echo $? | |
101 pushing to ../c | |
102 searching for changes | |
103 no changes found | |
104 0 | |
105 | |
106 $ hg push -r 3 ../c; echo $? | |
107 pushing to ../c | |
108 searching for changes | |
109 abort: push creates new remote heads on branch 'default'! | |
110 (did you forget to merge? use push -f to force) | |
111 255 | |
112 | |
113 $ hg push -r 3 -r 4 ../c; echo $? | |
114 pushing to ../c | |
115 searching for changes | |
116 abort: push creates new remote heads on branch 'default'! | |
117 (did you forget to merge? use push -f to force) | |
118 255 | |
119 | |
120 $ hg push -f -r 3 -r 4 ../c; echo $? | |
121 pushing to ../c | |
122 searching for changes | |
123 adding changesets | |
124 adding manifests | |
125 adding file changes | |
126 added 2 changesets with 2 changes to 1 files (+2 heads) | |
127 0 | |
128 | |
129 $ hg push -r 5 ../c; echo $? | |
130 pushing to ../c | |
131 searching for changes | |
132 adding changesets | |
133 adding manifests | |
134 adding file changes | |
135 added 1 changesets with 1 changes to 1 files (-1 heads) | |
136 0 | |
137 | |
138 $ hg in ../c | |
139 comparing with ../c | |
140 searching for changes | |
141 no changes found | |
142 | |
143 | |
144 Issue 450: | |
145 | |
146 $ hg init ../e | |
147 $ hg push -r 0 ../e ; echo $? | |
148 pushing to ../e | |
149 searching for changes | |
150 adding changesets | |
151 adding manifests | |
152 adding file changes | |
153 added 1 changesets with 1 changes to 1 files | |
154 0 | |
155 | |
156 $ hg push -r 1 ../e ; echo $? | |
157 pushing to ../e | |
158 searching for changes | |
159 adding changesets | |
160 adding manifests | |
161 adding file changes | |
162 added 1 changesets with 1 changes to 1 files | |
163 0 | |
164 | |
165 $ cd .. | |
166 | |
167 | |
168 Issue 736: | |
169 | |
170 $ hg init f | |
171 $ cd f | |
172 $ hg -q branch a | |
173 $ echo 0 > foo | |
174 $ hg -q ci -Am 0 | |
175 $ echo 1 > foo | |
176 $ hg -q ci -m 1 | |
177 $ hg -q up 0 | |
178 $ echo 2 > foo | |
179 $ hg -q ci -m 2 | |
180 $ hg -q up 0 | |
181 $ hg -q branch b | |
182 $ echo 3 > foo | |
183 $ hg -q ci -m 3 | |
184 $ cd .. | |
185 | |
186 $ hg -q clone f g | |
187 $ cd g | |
188 | |
189 Push on existing branch and new branch: | |
190 | |
191 $ hg -q up 1 | |
192 $ echo 4 > foo | |
193 $ hg -q ci -m 4 | |
194 $ hg -q up 0 | |
195 $ echo 5 > foo | |
196 $ hg -q branch c | |
197 $ hg -q ci -m 5 | |
198 | |
199 $ hg push ../f; echo $? | |
200 pushing to ../f | |
201 searching for changes | |
202 abort: push creates new remote branches: c! | |
203 (use 'hg push --new-branch' to create new remote branches) | |
204 255 | |
205 | |
206 $ hg push -r 4 -r 5 ../f; echo $? | |
207 pushing to ../f | |
208 searching for changes | |
209 abort: push creates new remote branches: c! | |
210 (use 'hg push --new-branch' to create new remote branches) | |
211 255 | |
212 | |
213 | |
214 Multiple new branches: | |
215 | |
216 $ hg -q branch d | |
217 $ echo 6 > foo | |
218 $ hg -q ci -m 6 | |
219 | |
220 $ hg push ../f; echo $? | |
221 pushing to ../f | |
222 searching for changes | |
223 abort: push creates new remote branches: c, d! | |
224 (use 'hg push --new-branch' to create new remote branches) | |
225 255 | |
226 | |
227 $ hg push -r 4 -r 6 ../f; echo $? | |
228 pushing to ../f | |
229 searching for changes | |
230 abort: push creates new remote branches: c, d! | |
231 (use 'hg push --new-branch' to create new remote branches) | |
232 255 | |
233 | |
234 $ cd ../g | |
235 | |
236 | |
237 Fail on multiple head push: | |
238 | |
239 $ hg -q up 1 | |
240 $ echo 7 > foo | |
241 $ hg -q ci -m 7 | |
242 | |
243 $ hg push -r 4 -r 7 ../f; echo $? | |
244 pushing to ../f | |
245 searching for changes | |
246 abort: push creates new remote heads on branch 'a'! | |
247 (did you forget to merge? use push -f to force) | |
248 255 | |
249 | |
250 Push replacement head on existing branches: | |
251 | |
252 $ hg -q up 3 | |
253 $ echo 8 > foo | |
254 $ hg -q ci -m 8 | |
255 | |
256 $ hg push -r 7 -r 8 ../f; echo $? | |
257 pushing to ../f | |
258 searching for changes | |
259 adding changesets | |
260 adding manifests | |
261 adding file changes | |
262 added 2 changesets with 2 changes to 1 files | |
263 0 | |
264 | |
265 | |
266 Merge of branch a to other branch b followed by unrelated push | |
267 on branch a: | |
268 | |
269 $ hg -q up 7 | |
270 $ HGMERGE=true hg -q merge 8 | |
271 $ hg -q ci -m 9 | |
272 $ hg -q up 8 | |
273 $ echo 10 > foo | |
274 $ hg -q ci -m 10 | |
275 | |
276 $ hg push -r 9 ../f; echo $? | |
277 pushing to ../f | |
278 searching for changes | |
279 adding changesets | |
280 adding manifests | |
281 adding file changes | |
282 added 1 changesets with 1 changes to 1 files (-1 heads) | |
283 0 | |
284 | |
285 $ hg push -r 10 ../f; echo $? | |
286 pushing to ../f | |
287 searching for changes | |
288 adding changesets | |
289 adding manifests | |
290 adding file changes | |
291 added 1 changesets with 1 changes to 1 files (+1 heads) | |
292 0 | |
293 | |
294 | |
295 Cheating the counting algorithm: | |
296 | |
297 $ hg -q up 9 | |
298 $ HGMERGE=true hg -q merge 2 | |
299 $ hg -q ci -m 11 | |
300 $ hg -q up 1 | |
301 $ echo 12 > foo | |
302 $ hg -q ci -m 12 | |
303 | |
304 $ hg push -r 11 -r 12 ../f; echo $? | |
305 pushing to ../f | |
306 searching for changes | |
307 adding changesets | |
308 adding manifests | |
309 adding file changes | |
310 added 2 changesets with 2 changes to 1 files | |
311 0 | |
312 | |
313 | |
314 Failed push of new named branch: | |
315 | |
316 $ echo 12 > foo | |
317 $ hg -q ci -m 12a | |
318 $ hg -q up 11 | |
319 $ echo 13 > foo | |
320 $ hg -q branch e | |
321 $ hg -q ci -m 13d | |
322 | |
323 $ hg push -r 12 -r 13 ../f; echo $? | |
324 pushing to ../f | |
325 searching for changes | |
326 abort: push creates new remote branches: e! | |
327 (use 'hg push --new-branch' to create new remote branches) | |
328 255 | |
329 | |
330 | |
331 Using --new-branch to push new named branch: | |
332 | |
333 $ hg push --new-branch -r 12 -r 13 ../f; echo $? | |
334 pushing to ../f | |
335 searching for changes | |
336 adding changesets | |
337 adding manifests | |
338 adding file changes | |
339 added 1 changesets with 1 changes to 1 files | |
340 0 | |
341 | |
342 | |
343 Checking prepush logic does not allow silently pushing | |
344 multiple new heads: | |
345 | |
346 $ cd .. | |
347 $ hg init h | |
348 $ echo init > h/init | |
349 $ hg -R h ci -Am init | |
350 adding init | |
351 $ echo a > h/a | |
352 $ hg -R h ci -Am a | |
353 adding a | |
354 $ hg clone h i | |
355 updating to branch default | |
356 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
357 $ hg -R h up 0 | |
358 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
359 $ echo b > h/b | |
360 $ hg -R h ci -Am b | |
361 adding b | |
362 created new head | |
363 $ hg -R i up 0 | |
364 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
365 $ echo c > i/c | |
366 $ hg -R i ci -Am c | |
367 adding c | |
368 created new head | |
369 | |
370 $ hg -R i push h | |
371 pushing to h | |
372 searching for changes | |
373 abort: push creates new remote heads on branch 'default'! | |
374 (you should pull and merge or use push -f to force) | |
375 | |
376 | |
377 Check prepush logic with merged branches: | |
378 | |
379 $ hg init j | |
380 $ hg -R j branch a | |
381 marked working directory as branch a | |
382 $ echo init > j/foo | |
383 $ hg -R j ci -Am init | |
384 adding foo | |
385 $ hg clone j k | |
386 updating to branch a | |
387 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
388 $ echo a1 > j/foo | |
389 $ hg -R j ci -m a1 | |
390 $ hg -R k branch b | |
391 marked working directory as branch b | |
392 $ echo b > k/foo | |
393 $ hg -R k ci -m b | |
394 $ hg -R k up 0 | |
395 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
396 | |
397 $ hg -R k merge b | |
398 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
399 (branch merge, don't forget to commit) | |
400 | |
401 $ hg -R k ci -m merge | |
402 | |
403 $ hg -R k push -r a j | |
404 pushing to j | |
405 searching for changes | |
406 abort: push creates new remote branches: b! | |
407 (use 'hg push --new-branch' to create new remote branches) | |
408 | |
409 | |
410 Prepush -r should not allow you to sneak in new heads: | |
411 | |
412 $ hg init l | |
413 $ cd l | |
414 $ echo a >> foo | |
415 $ hg -q add foo | |
416 $ hg -q branch a | |
417 $ hg -q ci -ma | |
418 $ hg -q up null | |
419 $ echo a >> foo | |
420 $ hg -q add foo | |
421 $ hg -q branch b | |
422 $ hg -q ci -mb | |
423 $ cd .. | |
424 $ hg -q clone l m -u a | |
425 $ cd m | |
426 $ hg -q merge b | |
427 $ hg -q ci -mmb | |
428 $ hg -q up 0 | |
429 $ echo a >> foo | |
430 $ hg -q ci -ma2 | |
431 $ hg -q up 2 | |
432 $ echo a >> foo | |
433 $ hg -q branch -f b | |
434 $ hg -q ci -mb2 | |
435 $ hg -q merge 3 | |
436 $ hg -q ci -mma | |
437 | |
438 $ hg push ../l -b b | |
439 pushing to ../l | |
440 searching for changes | |
441 abort: push creates new remote heads on branch 'a'! | |
442 (did you forget to merge? use push -f to force) | |
443 | |
444 $ cd .. | |
445 | |
446 | |
447 Check prepush with new branch head on former topo non-head: | |
448 | |
449 $ hg init n | |
450 $ cd n | |
451 $ hg branch A | |
452 marked working directory as branch A | |
453 $ echo a >a | |
454 $ hg ci -Ama | |
455 adding a | |
456 $ hg branch B | |
457 marked working directory as branch B | |
458 $ echo b >b | |
459 $ hg ci -Amb | |
460 adding b | |
461 | |
462 # b is now branch head of B, and a topological head | |
463 # a is now branch head of A, but not a topological head | |
464 | |
465 $ hg clone . inner | |
466 updating to branch B | |
467 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
468 $ cd inner | |
469 $ hg up B | |
470 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
471 $ echo b1 >b1 | |
472 $ hg ci -Amb1 | |
473 adding b1 | |
474 | |
475 # in the clone b1 is now the head of B | |
476 | |
477 $ cd .. | |
478 $ hg up 0 | |
479 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
480 $ echo a2 >a2 | |
481 $ hg ci -Ama2 | |
482 adding a2 | |
483 | |
484 # a2 is now the new branch head of A, and a new topological head | |
485 # it replaces a former inner branch head, so it should at most warn about A, not B | |
486 | |
487 glog of local: | |
488 | |
489 $ hg glog --template "{rev}: {branches} {desc}\n" | |
490 @ 2: A a2 | |
491 | | |
492 | o 1: B b | |
493 |/ | |
494 o 0: A a | |
495 | |
496 glog of remote: | |
497 | |
498 $ hg glog -R inner --template "{rev}: {branches} {desc}\n" | |
499 @ 2: B b1 | |
500 | | |
501 o 1: B b | |
502 | | |
503 o 0: A a | |
504 | |
505 outgoing: | |
506 | |
507 $ hg out inner --template "{rev}: {branches} {desc}\n" | |
508 comparing with inner | |
509 searching for changes | |
510 2: A a2 | |
511 | |
512 $ hg push inner | |
513 pushing to inner | |
514 searching for changes | |
515 adding changesets | |
516 adding manifests | |
517 adding file changes | |
518 added 1 changesets with 1 changes to 1 files (+1 heads) | |
519 | |
520 $ cd .. | |
521 | |
522 | |
523 Check prepush with new branch head on former topo head: | |
524 | |
525 $ hg init o | |
526 $ cd o | |
527 $ hg branch A | |
528 marked working directory as branch A | |
529 $ echo a >a | |
530 $ hg ci -Ama | |
531 adding a | |
532 $ hg branch B | |
533 marked working directory as branch B | |
534 $ echo b >b | |
535 $ hg ci -Amb | |
536 adding b | |
537 | |
538 # b is now branch head of B, and a topological head | |
539 | |
540 $ hg up 0 | |
541 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
542 $ echo a1 >a1 | |
543 $ hg ci -Ama1 | |
544 adding a1 | |
545 | |
546 # a1 is now branch head of A, and a topological head | |
547 | |
548 $ hg clone . inner | |
549 updating to branch A | |
550 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
551 $ cd inner | |
552 $ hg up B | |
553 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
554 $ echo b1 >b1 | |
555 $ hg ci -Amb1 | |
556 adding b1 | |
557 | |
558 # in the clone b1 is now the head of B | |
559 | |
560 $ cd .. | |
561 $ echo a2 >a2 | |
562 $ hg ci -Ama2 | |
563 adding a2 | |
564 | |
565 # a2 is now the new branch head of A, and a topological head | |
566 # it replaces a former topological and branch head, so this should not warn | |
567 | |
568 glog of local: | |
569 | |
570 $ hg glog --template "{rev}: {branches} {desc}\n" | |
571 @ 3: A a2 | |
572 | | |
573 o 2: A a1 | |
574 | | |
575 | o 1: B b | |
576 |/ | |
577 o 0: A a | |
578 | |
579 glog of remote: | |
580 | |
581 $ hg glog -R inner --template "{rev}: {branches} {desc}\n" | |
582 @ 3: B b1 | |
583 | | |
584 | o 2: A a1 | |
585 | | | |
586 o | 1: B b | |
587 |/ | |
588 o 0: A a | |
589 | |
590 outgoing: | |
591 | |
592 $ hg out inner --template "{rev}: {branches} {desc}\n" | |
593 comparing with inner | |
594 searching for changes | |
595 3: A a2 | |
596 | |
597 $ hg push inner | |
598 pushing to inner | |
599 searching for changes | |
600 adding changesets | |
601 adding manifests | |
602 adding file changes | |
603 added 1 changesets with 1 changes to 1 files | |
604 | |
605 $ cd .. | |
606 | |
607 | |
608 Check prepush with new branch head and new child of former branch head | |
609 but child is on different branch: | |
610 | |
611 $ hg init p | |
612 $ cd p | |
613 $ hg branch A | |
614 marked working directory as branch A | |
615 $ echo a0 >a | |
616 $ hg ci -Ama0 | |
617 adding a | |
618 $ echo a1 >a | |
619 $ hg ci -ma1 | |
620 $ hg up null | |
621 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
622 $ hg branch B | |
623 marked working directory as branch B | |
624 $ echo b0 >b | |
625 $ hg ci -Amb0 | |
626 adding b | |
627 $ echo b1 >b | |
628 $ hg ci -mb1 | |
629 | |
630 $ hg clone . inner | |
631 updating to branch B | |
632 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
633 | |
634 $ hg up A | |
635 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
636 $ hg branch -f B | |
637 marked working directory as branch B | |
638 $ echo a3 >a | |
639 $ hg ci -ma3 | |
640 created new head | |
641 $ hg up 3 | |
642 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
643 $ hg branch -f A | |
644 marked working directory as branch A | |
645 $ echo b3 >b | |
646 $ hg ci -mb3 | |
647 created new head | |
648 | |
649 glog of local: | |
650 | |
651 $ hg glog --template "{rev}: {branches} {desc}\n" | |
652 @ 5: A b3 | |
653 | | |
654 | o 4: B a3 | |
655 | | | |
656 o | 3: B b1 | |
657 | | | |
658 o | 2: B b0 | |
659 / | |
660 o 1: A a1 | |
661 | | |
662 o 0: A a0 | |
663 | |
664 glog of remote: | |
665 | |
666 $ hg glog -R inner --template "{rev}: {branches} {desc}\n" | |
667 @ 3: B b1 | |
668 | | |
669 o 2: B b0 | |
670 | |
671 o 1: A a1 | |
672 | | |
673 o 0: A a0 | |
674 | |
675 outgoing: | |
676 | |
677 $ hg out inner --template "{rev}: {branches} {desc}\n" | |
678 comparing with inner | |
679 searching for changes | |
680 4: B a3 | |
681 5: A b3 | |
682 | |
683 $ hg push inner | |
684 pushing to inner | |
685 searching for changes | |
686 abort: push creates new remote heads on branch 'A'! | |
687 (did you forget to merge? use push -f to force) | |
688 | |
689 $ hg push inner -r4 -r5 | |
690 pushing to inner | |
691 searching for changes | |
692 abort: push creates new remote heads on branch 'A'! | |
693 (did you forget to merge? use push -f to force) | |
694 | |
695 $ hg in inner | |
696 comparing with inner | |
697 searching for changes | |
698 no changes found | |
699 | |
700 $ cd .. | |
701 |