Mercurial > hg
annotate tests/test-push-warn.t @ 13158:9e7e24052745
merge: fast-forward merge with descendant
issue2538 gives a case where a changeset is merged with its child (which is on
another branch), and to my surprise the result is a real merge with two
parents, not just a "fast forward" "merge" with only the child as parent.
That is essentially the same as issue619.
Is the existing behaviour as intended and correct?
Or is the following fix correct?
Some extra "created new head" pops up with this fix, but it seems to me like
they could be considered correct. The old branch head has been superseeded by
changes on the other branch, and when the changes on the other branch is merged
back to the branch it will introduce a new head not directly related to the
previous branch head.
(I guess the intention with existing behaviour could be to ensure that the
changesets on the branch are directly connected and that no new heads pops up
on merges.)
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Tue, 07 Dec 2010 03:29:21 +0100 |
parents | 91cb08a9e7fb |
children | 1792b8a9422b |
rev | line source |
---|---|
12279 | 1 $ echo "[extensions]" >> $HGRCPATH |
2 $ echo "graphlog=" >> $HGRCPATH | |
816
8674b7803714
Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff
changeset
|
3 |
12279 | 4 $ mkdir a |
5 $ cd a | |
6 $ hg init | |
7 $ echo foo > t1 | |
8 $ hg add t1 | |
9 $ hg commit -m "1" | |
10875
a9702c47a19f
partial backout of 1e819576e926 and add tests (issue2131)
Sune Foldager <cryo@cyanite.org>
parents:
10771
diff
changeset
|
10 |
12279 | 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" | |
816
8674b7803714
Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff
changeset
|
25 |
12279 | 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) | |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
31 [255] |
816
8674b7803714
Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff
changeset
|
32 |
12998
91cb08a9e7fb
discovery: list new remote heads in prepush() on --debug
Adrian Buehlmann <adrian@cadifra.com>
parents:
12785
diff
changeset
|
33 $ hg push --debug ../a |
91cb08a9e7fb
discovery: list new remote heads in prepush() on --debug
Adrian Buehlmann <adrian@cadifra.com>
parents:
12785
diff
changeset
|
34 pushing to ../a |
91cb08a9e7fb
discovery: list new remote heads in prepush() on --debug
Adrian Buehlmann <adrian@cadifra.com>
parents:
12785
diff
changeset
|
35 searching for changes |
91cb08a9e7fb
discovery: list new remote heads in prepush() on --debug
Adrian Buehlmann <adrian@cadifra.com>
parents:
12785
diff
changeset
|
36 examining 1c9246a22a0a:d8d565842d04 |
91cb08a9e7fb
discovery: list new remote heads in prepush() on --debug
Adrian Buehlmann <adrian@cadifra.com>
parents:
12785
diff
changeset
|
37 found incomplete branch 1c9246a22a0a:d8d565842d04 |
91cb08a9e7fb
discovery: list new remote heads in prepush() on --debug
Adrian Buehlmann <adrian@cadifra.com>
parents:
12785
diff
changeset
|
38 searching: 1 queries |
91cb08a9e7fb
discovery: list new remote heads in prepush() on --debug
Adrian Buehlmann <adrian@cadifra.com>
parents:
12785
diff
changeset
|
39 narrowing 1:1 d8d565842d04 |
91cb08a9e7fb
discovery: list new remote heads in prepush() on --debug
Adrian Buehlmann <adrian@cadifra.com>
parents:
12785
diff
changeset
|
40 found new branch changeset 1c9246a22a0a |
91cb08a9e7fb
discovery: list new remote heads in prepush() on --debug
Adrian Buehlmann <adrian@cadifra.com>
parents:
12785
diff
changeset
|
41 found new changesets starting at 1c9246a22a0a |
91cb08a9e7fb
discovery: list new remote heads in prepush() on --debug
Adrian Buehlmann <adrian@cadifra.com>
parents:
12785
diff
changeset
|
42 1 total queries |
91cb08a9e7fb
discovery: list new remote heads in prepush() on --debug
Adrian Buehlmann <adrian@cadifra.com>
parents:
12785
diff
changeset
|
43 common changesets up to d8d565842d04 |
91cb08a9e7fb
discovery: list new remote heads in prepush() on --debug
Adrian Buehlmann <adrian@cadifra.com>
parents:
12785
diff
changeset
|
44 new remote heads on branch 'default' |
91cb08a9e7fb
discovery: list new remote heads in prepush() on --debug
Adrian Buehlmann <adrian@cadifra.com>
parents:
12785
diff
changeset
|
45 new remote head 1e108cc5548c |
91cb08a9e7fb
discovery: list new remote heads in prepush() on --debug
Adrian Buehlmann <adrian@cadifra.com>
parents:
12785
diff
changeset
|
46 abort: push creates new remote heads on branch 'default'! |
91cb08a9e7fb
discovery: list new remote heads in prepush() on --debug
Adrian Buehlmann <adrian@cadifra.com>
parents:
12785
diff
changeset
|
47 (you should pull and merge or use push -f to force) |
91cb08a9e7fb
discovery: list new remote heads in prepush() on --debug
Adrian Buehlmann <adrian@cadifra.com>
parents:
12785
diff
changeset
|
48 [255] |
91cb08a9e7fb
discovery: list new remote heads in prepush() on --debug
Adrian Buehlmann <adrian@cadifra.com>
parents:
12785
diff
changeset
|
49 |
12279 | 50 $ hg pull ../a |
51 pulling from ../a | |
52 searching for changes | |
53 adding changesets | |
54 adding manifests | |
55 adding file changes | |
56 added 1 changesets with 1 changes to 1 files (+1 heads) | |
57 (run 'hg heads' to see heads, 'hg merge' to merge) | |
816
8674b7803714
Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff
changeset
|
58 |
12279 | 59 $ hg push ../a |
60 pushing to ../a | |
61 searching for changes | |
62 abort: push creates new remote heads on branch 'default'! | |
63 (did you forget to merge? use push -f to force) | |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
64 [255] |
12279 | 65 |
66 $ hg merge | |
67 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
68 (branch merge, don't forget to commit) | |
816
8674b7803714
Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff
changeset
|
69 |
12279 | 70 $ hg commit -m "4" |
71 $ hg push ../a | |
72 pushing to ../a | |
73 searching for changes | |
74 adding changesets | |
75 adding manifests | |
76 adding file changes | |
77 added 2 changesets with 1 changes to 1 files | |
78 | |
79 $ cd .. | |
80 | |
81 $ hg init c | |
82 $ cd c | |
83 $ for i in 0 1 2; do | |
84 > echo $i >> foo | |
85 > hg ci -Am $i | |
86 > done | |
87 adding foo | |
88 $ cd .. | |
89 | |
90 $ hg clone c d | |
91 updating to branch default | |
92 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
2021
fc22ed56afe3
Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1933
diff
changeset
|
93 |
12279 | 94 $ cd d |
95 $ for i in 0 1; do | |
96 > hg co -C $i | |
97 > echo d-$i >> foo | |
98 > hg ci -m d-$i | |
99 > done | |
100 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
101 created new head | |
102 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
103 created new head | |
104 | |
105 $ HGMERGE=true hg merge 3 | |
106 merging foo | |
107 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
108 (branch merge, don't forget to commit) | |
109 | |
110 $ hg ci -m c-d | |
2021
fc22ed56afe3
Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1933
diff
changeset
|
111 |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
112 $ hg push ../c |
12279 | 113 pushing to ../c |
114 searching for changes | |
115 abort: push creates new remote heads on branch 'default'! | |
116 (did you forget to merge? use push -f to force) | |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
117 [255] |
2021
fc22ed56afe3
Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1933
diff
changeset
|
118 |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
119 $ hg push -r 2 ../c |
12279 | 120 pushing to ../c |
121 searching for changes | |
122 no changes found | |
123 | |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
124 $ hg push -r 3 ../c |
12279 | 125 pushing to ../c |
126 searching for changes | |
127 abort: push creates new remote heads on branch 'default'! | |
128 (did you forget to merge? use push -f to force) | |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
129 [255] |
2021
fc22ed56afe3
Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1933
diff
changeset
|
130 |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
131 $ hg push -r 3 -r 4 ../c |
12279 | 132 pushing to ../c |
133 searching for changes | |
134 abort: push creates new remote heads on branch 'default'! | |
135 (did you forget to merge? use push -f to force) | |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
136 [255] |
12279 | 137 |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
138 $ hg push -f -r 3 -r 4 ../c |
12279 | 139 pushing to ../c |
140 searching for changes | |
141 adding changesets | |
142 adding manifests | |
143 adding file changes | |
144 added 2 changesets with 2 changes to 1 files (+2 heads) | |
145 | |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
146 $ hg push -r 5 ../c |
12279 | 147 pushing to ../c |
148 searching for changes | |
149 adding changesets | |
150 adding manifests | |
151 adding file changes | |
152 added 1 changesets with 1 changes to 1 files (-1 heads) | |
2021
fc22ed56afe3
Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1933
diff
changeset
|
153 |
12279 | 154 $ hg in ../c |
155 comparing with ../c | |
156 searching for changes | |
157 no changes found | |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
158 [1] |
12279 | 159 |
160 | |
12399
4fee1fd3de9a
tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents:
12365
diff
changeset
|
161 Issue450: push -r warns about remote head creation even if no heads |
4fee1fd3de9a
tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents:
12365
diff
changeset
|
162 will be created |
3923
27230c29bfec
fix calculation of new heads added during push with -r
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3803
diff
changeset
|
163 |
12279 | 164 $ hg init ../e |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
165 $ hg push -r 0 ../e |
12279 | 166 pushing to ../e |
167 searching for changes | |
168 adding changesets | |
169 adding manifests | |
170 adding file changes | |
171 added 1 changesets with 1 changes to 1 files | |
172 | |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
173 $ hg push -r 1 ../e |
12279 | 174 pushing to ../e |
175 searching for changes | |
176 adding changesets | |
177 adding manifests | |
178 adding file changes | |
179 added 1 changesets with 1 changes to 1 files | |
180 | |
181 $ cd .. | |
182 | |
183 | |
12399
4fee1fd3de9a
tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents:
12365
diff
changeset
|
184 Issue736: named branches are not considered for detection of |
4fee1fd3de9a
tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents:
12365
diff
changeset
|
185 unmerged heads in "hg push" |
8565
268d16b2ec25
tests: add tests for new pre-push logic (issue736)
Sune Foldager <cryo@cyanite.org>
parents:
3923
diff
changeset
|
186 |
12279 | 187 $ hg init f |
188 $ cd f | |
189 $ hg -q branch a | |
190 $ echo 0 > foo | |
191 $ hg -q ci -Am 0 | |
192 $ echo 1 > foo | |
193 $ hg -q ci -m 1 | |
194 $ hg -q up 0 | |
195 $ echo 2 > foo | |
196 $ hg -q ci -m 2 | |
197 $ hg -q up 0 | |
198 $ hg -q branch b | |
199 $ echo 3 > foo | |
200 $ hg -q ci -m 3 | |
201 $ cd .. | |
202 | |
203 $ hg -q clone f g | |
204 $ cd g | |
205 | |
206 Push on existing branch and new branch: | |
8565
268d16b2ec25
tests: add tests for new pre-push logic (issue736)
Sune Foldager <cryo@cyanite.org>
parents:
3923
diff
changeset
|
207 |
12279 | 208 $ hg -q up 1 |
209 $ echo 4 > foo | |
210 $ hg -q ci -m 4 | |
211 $ hg -q up 0 | |
212 $ echo 5 > foo | |
213 $ hg -q branch c | |
214 $ hg -q ci -m 5 | |
215 | |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
216 $ hg push ../f |
12279 | 217 pushing to ../f |
218 searching for changes | |
219 abort: push creates new remote branches: c! | |
220 (use 'hg push --new-branch' to create new remote branches) | |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
221 [255] |
8565
268d16b2ec25
tests: add tests for new pre-push logic (issue736)
Sune Foldager <cryo@cyanite.org>
parents:
3923
diff
changeset
|
222 |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
223 $ hg push -r 4 -r 5 ../f |
12279 | 224 pushing to ../f |
225 searching for changes | |
226 abort: push creates new remote branches: c! | |
227 (use 'hg push --new-branch' to create new remote branches) | |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
228 [255] |
12279 | 229 |
230 | |
231 Multiple new branches: | |
8565
268d16b2ec25
tests: add tests for new pre-push logic (issue736)
Sune Foldager <cryo@cyanite.org>
parents:
3923
diff
changeset
|
232 |
12279 | 233 $ hg -q branch d |
234 $ echo 6 > foo | |
235 $ hg -q ci -m 6 | |
236 | |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
237 $ hg push ../f |
12279 | 238 pushing to ../f |
239 searching for changes | |
240 abort: push creates new remote branches: c, d! | |
241 (use 'hg push --new-branch' to create new remote branches) | |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
242 [255] |
10354
844d83da2da9
prepush: warn about every new outgoing named branch, not just the first
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
9954
diff
changeset
|
243 |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
244 $ hg push -r 4 -r 6 ../f |
12279 | 245 pushing to ../f |
246 searching for changes | |
247 abort: push creates new remote branches: c, d! | |
248 (use 'hg push --new-branch' to create new remote branches) | |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
249 [255] |
12279 | 250 |
251 $ cd ../g | |
252 | |
253 | |
254 Fail on multiple head push: | |
255 | |
256 $ hg -q up 1 | |
257 $ echo 7 > foo | |
258 $ hg -q ci -m 7 | |
259 | |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
260 $ hg push -r 4 -r 7 ../f |
12279 | 261 pushing to ../f |
262 searching for changes | |
263 abort: push creates new remote heads on branch 'a'! | |
264 (did you forget to merge? use push -f to force) | |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
265 [255] |
12279 | 266 |
267 Push replacement head on existing branches: | |
268 | |
269 $ hg -q up 3 | |
270 $ echo 8 > foo | |
271 $ hg -q ci -m 8 | |
8565
268d16b2ec25
tests: add tests for new pre-push logic (issue736)
Sune Foldager <cryo@cyanite.org>
parents:
3923
diff
changeset
|
272 |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
273 $ hg push -r 7 -r 8 ../f |
12279 | 274 pushing to ../f |
275 searching for changes | |
276 adding changesets | |
277 adding manifests | |
278 adding file changes | |
279 added 2 changesets with 2 changes to 1 files | |
280 | |
281 | |
282 Merge of branch a to other branch b followed by unrelated push | |
283 on branch a: | |
284 | |
285 $ hg -q up 7 | |
286 $ HGMERGE=true hg -q merge 8 | |
287 $ hg -q ci -m 9 | |
288 $ hg -q up 8 | |
289 $ echo 10 > foo | |
290 $ hg -q ci -m 10 | |
291 | |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
292 $ hg push -r 9 ../f |
12279 | 293 pushing to ../f |
294 searching for changes | |
295 adding changesets | |
296 adding manifests | |
297 adding file changes | |
298 added 1 changesets with 1 changes to 1 files (-1 heads) | |
8565
268d16b2ec25
tests: add tests for new pre-push logic (issue736)
Sune Foldager <cryo@cyanite.org>
parents:
3923
diff
changeset
|
299 |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
300 $ hg push -r 10 ../f |
12279 | 301 pushing to ../f |
302 searching for changes | |
303 adding changesets | |
304 adding manifests | |
305 adding file changes | |
306 added 1 changesets with 1 changes to 1 files (+1 heads) | |
307 | |
308 | |
309 Cheating the counting algorithm: | |
310 | |
311 $ hg -q up 9 | |
312 $ HGMERGE=true hg -q merge 2 | |
313 $ hg -q ci -m 11 | |
314 $ hg -q up 1 | |
315 $ echo 12 > foo | |
316 $ hg -q ci -m 12 | |
317 | |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
318 $ hg push -r 11 -r 12 ../f |
12279 | 319 pushing to ../f |
320 searching for changes | |
321 adding changesets | |
322 adding manifests | |
323 adding file changes | |
324 added 2 changesets with 2 changes to 1 files | |
325 | |
8565
268d16b2ec25
tests: add tests for new pre-push logic (issue736)
Sune Foldager <cryo@cyanite.org>
parents:
3923
diff
changeset
|
326 |
12279 | 327 Failed push of new named branch: |
328 | |
329 $ echo 12 > foo | |
330 $ hg -q ci -m 12a | |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
331 [1] |
12279 | 332 $ hg -q up 11 |
333 $ echo 13 > foo | |
334 $ hg -q branch e | |
335 $ hg -q ci -m 13d | |
8565
268d16b2ec25
tests: add tests for new pre-push logic (issue736)
Sune Foldager <cryo@cyanite.org>
parents:
3923
diff
changeset
|
336 |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
337 $ hg push -r 12 -r 13 ../f |
12279 | 338 pushing to ../f |
339 searching for changes | |
340 abort: push creates new remote branches: e! | |
341 (use 'hg push --new-branch' to create new remote branches) | |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
342 [255] |
12279 | 343 |
344 | |
345 Using --new-branch to push new named branch: | |
11211
e43c23d189a5
push: add --new-branch option to allow intial push of new branches
Sune Foldager <cryo@cyanite.org>
parents:
10925
diff
changeset
|
346 |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12328
diff
changeset
|
347 $ hg push --new-branch -r 12 -r 13 ../f |
12279 | 348 pushing to ../f |
349 searching for changes | |
350 adding changesets | |
351 adding manifests | |
352 adding file changes | |
353 added 1 changesets with 1 changes to 1 files | |
354 | |
11211
e43c23d189a5
push: add --new-branch option to allow intial push of new branches
Sune Foldager <cryo@cyanite.org>
parents:
10925
diff
changeset
|
355 |
12785
c7d23b4ca4ba
check-code: warning and fixes for whitespace in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12399
diff
changeset
|
356 Checking prepush logic does not allow silently pushing |
12279 | 357 multiple new heads: |
358 | |
359 $ cd .. | |
360 $ hg init h | |
361 $ echo init > h/init | |
362 $ hg -R h ci -Am init | |
363 adding init | |
364 $ echo a > h/a | |
365 $ hg -R h ci -Am a | |
366 adding a | |
367 $ hg clone h i | |
368 updating to branch default | |
369 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
370 $ hg -R h up 0 | |
371 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
372 $ echo b > h/b | |
373 $ hg -R h ci -Am b | |
374 adding b | |
375 created new head | |
376 $ hg -R i up 0 | |
377 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
378 $ echo c > i/c | |
379 $ hg -R i ci -Am c | |
380 adding c | |
381 created new head | |
9479
f3569d95c2ab
push: fix subtle bug in prepush logic
Sune Foldager <cryo@cyanite.org>
parents:
8565
diff
changeset
|
382 |
12279 | 383 $ hg -R i push h |
384 pushing to h | |
385 searching for changes | |
386 abort: push creates new remote heads on branch 'default'! | |
387 (you should pull and merge or use push -f to force) | |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
388 [255] |
12279 | 389 |
390 | |
391 Check prepush logic with merged branches: | |
392 | |
393 $ hg init j | |
394 $ hg -R j branch a | |
395 marked working directory as branch a | |
396 $ echo init > j/foo | |
397 $ hg -R j ci -Am init | |
398 adding foo | |
399 $ hg clone j k | |
400 updating to branch a | |
401 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
402 $ echo a1 > j/foo | |
403 $ hg -R j ci -m a1 | |
404 $ hg -R k branch b | |
405 marked working directory as branch b | |
406 $ echo b > k/foo | |
407 $ hg -R k ci -m b | |
408 $ hg -R k up 0 | |
409 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
410 | |
411 $ hg -R k merge b | |
412 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
413 (branch merge, don't forget to commit) | |
414 | |
415 $ hg -R k ci -m merge | |
13158
9e7e24052745
merge: fast-forward merge with descendant
Mads Kiilerich <mads@kiilerich.com>
parents:
12998
diff
changeset
|
416 created new head |
9954
d6a307719ccb
fix bug in prepush logic involving merge changesets
Sune Foldager <cryo@cyanite.org>
parents:
9609
diff
changeset
|
417 |
12279 | 418 $ hg -R k push -r a j |
419 pushing to j | |
420 searching for changes | |
421 abort: push creates new remote branches: b! | |
422 (use 'hg push --new-branch' to create new remote branches) | |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
423 [255] |
12279 | 424 |
425 | |
426 Prepush -r should not allow you to sneak in new heads: | |
10875
a9702c47a19f
partial backout of 1e819576e926 and add tests (issue2131)
Sune Foldager <cryo@cyanite.org>
parents:
10771
diff
changeset
|
427 |
12279 | 428 $ hg init l |
429 $ cd l | |
430 $ echo a >> foo | |
431 $ hg -q add foo | |
432 $ hg -q branch a | |
433 $ hg -q ci -ma | |
434 $ hg -q up null | |
435 $ echo a >> foo | |
436 $ hg -q add foo | |
437 $ hg -q branch b | |
438 $ hg -q ci -mb | |
439 $ cd .. | |
440 $ hg -q clone l m -u a | |
441 $ cd m | |
442 $ hg -q merge b | |
443 $ hg -q ci -mmb | |
444 $ hg -q up 0 | |
445 $ echo a >> foo | |
446 $ hg -q ci -ma2 | |
447 $ hg -q up 2 | |
448 $ echo a >> foo | |
449 $ hg -q branch -f b | |
450 $ hg -q ci -mb2 | |
451 $ hg -q merge 3 | |
452 $ hg -q ci -mma | |
453 | |
454 $ hg push ../l -b b | |
455 pushing to ../l | |
456 searching for changes | |
457 abort: push creates new remote heads on branch 'a'! | |
458 (did you forget to merge? use push -f to force) | |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
459 [255] |
12279 | 460 |
461 $ cd .. | |
462 | |
463 | |
464 Check prepush with new branch head on former topo non-head: | |
465 | |
466 $ hg init n | |
467 $ cd n | |
468 $ hg branch A | |
469 marked working directory as branch A | |
470 $ echo a >a | |
471 $ hg ci -Ama | |
472 adding a | |
473 $ hg branch B | |
474 marked working directory as branch B | |
475 $ echo b >b | |
476 $ hg ci -Amb | |
477 adding b | |
478 | |
12328
b63f6422d2a7
tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12316
diff
changeset
|
479 b is now branch head of B, and a topological head |
b63f6422d2a7
tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12316
diff
changeset
|
480 a is now branch head of A, but not a topological head |
12279 | 481 |
482 $ hg clone . inner | |
483 updating to branch B | |
484 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
485 $ cd inner | |
486 $ hg up B | |
487 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
488 $ echo b1 >b1 | |
489 $ hg ci -Amb1 | |
490 adding b1 | |
491 | |
12328
b63f6422d2a7
tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12316
diff
changeset
|
492 in the clone b1 is now the head of B |
12279 | 493 |
494 $ cd .. | |
495 $ hg up 0 | |
496 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
497 $ echo a2 >a2 | |
498 $ hg ci -Ama2 | |
499 adding a2 | |
500 | |
12785
c7d23b4ca4ba
check-code: warning and fixes for whitespace in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12399
diff
changeset
|
501 a2 is now the new branch head of A, and a new topological head |
12328
b63f6422d2a7
tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12316
diff
changeset
|
502 it replaces a former inner branch head, so it should at most warn about |
b63f6422d2a7
tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12316
diff
changeset
|
503 A, not B |
12279 | 504 |
505 glog of local: | |
506 | |
507 $ hg glog --template "{rev}: {branches} {desc}\n" | |
508 @ 2: A a2 | |
509 | | |
510 | o 1: B b | |
511 |/ | |
512 o 0: A a | |
513 | |
514 glog of remote: | |
515 | |
516 $ hg glog -R inner --template "{rev}: {branches} {desc}\n" | |
517 @ 2: B b1 | |
518 | | |
519 o 1: B b | |
520 | | |
521 o 0: A a | |
522 | |
523 outgoing: | |
524 | |
525 $ hg out inner --template "{rev}: {branches} {desc}\n" | |
526 comparing with inner | |
527 searching for changes | |
528 2: A a2 | |
529 | |
530 $ hg push inner | |
531 pushing to inner | |
532 searching for changes | |
533 adding changesets | |
534 adding manifests | |
535 adding file changes | |
536 added 1 changesets with 1 changes to 1 files (+1 heads) | |
537 | |
538 $ cd .. | |
539 | |
540 | |
541 Check prepush with new branch head on former topo head: | |
10875
a9702c47a19f
partial backout of 1e819576e926 and add tests (issue2131)
Sune Foldager <cryo@cyanite.org>
parents:
10771
diff
changeset
|
542 |
12279 | 543 $ hg init o |
544 $ cd o | |
545 $ hg branch A | |
546 marked working directory as branch A | |
547 $ echo a >a | |
548 $ hg ci -Ama | |
549 adding a | |
550 $ hg branch B | |
551 marked working directory as branch B | |
552 $ echo b >b | |
553 $ hg ci -Amb | |
554 adding b | |
555 | |
12328
b63f6422d2a7
tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12316
diff
changeset
|
556 b is now branch head of B, and a topological head |
12279 | 557 |
558 $ hg up 0 | |
559 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
560 $ echo a1 >a1 | |
561 $ hg ci -Ama1 | |
562 adding a1 | |
563 | |
12328
b63f6422d2a7
tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12316
diff
changeset
|
564 a1 is now branch head of A, and a topological head |
12279 | 565 |
566 $ hg clone . inner | |
567 updating to branch A | |
568 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
569 $ cd inner | |
570 $ hg up B | |
571 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
572 $ echo b1 >b1 | |
573 $ hg ci -Amb1 | |
574 adding b1 | |
575 | |
12328
b63f6422d2a7
tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12316
diff
changeset
|
576 in the clone b1 is now the head of B |
12279 | 577 |
578 $ cd .. | |
579 $ echo a2 >a2 | |
580 $ hg ci -Ama2 | |
581 adding a2 | |
582 | |
12328
b63f6422d2a7
tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12316
diff
changeset
|
583 a2 is now the new branch head of A, and a topological head |
b63f6422d2a7
tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12316
diff
changeset
|
584 it replaces a former topological and branch head, so this should not warn |
12279 | 585 |
586 glog of local: | |
587 | |
588 $ hg glog --template "{rev}: {branches} {desc}\n" | |
589 @ 3: A a2 | |
590 | | |
591 o 2: A a1 | |
592 | | |
593 | o 1: B b | |
594 |/ | |
595 o 0: A a | |
596 | |
597 glog of remote: | |
598 | |
599 $ hg glog -R inner --template "{rev}: {branches} {desc}\n" | |
600 @ 3: B b1 | |
601 | | |
602 | o 2: A a1 | |
603 | | | |
604 o | 1: B b | |
605 |/ | |
606 o 0: A a | |
607 | |
608 outgoing: | |
609 | |
610 $ hg out inner --template "{rev}: {branches} {desc}\n" | |
611 comparing with inner | |
612 searching for changes | |
613 3: A a2 | |
614 | |
615 $ hg push inner | |
616 pushing to inner | |
617 searching for changes | |
618 adding changesets | |
619 adding manifests | |
620 adding file changes | |
621 added 1 changesets with 1 changes to 1 files | |
622 | |
623 $ cd .. | |
624 | |
625 | |
626 Check prepush with new branch head and new child of former branch head | |
627 but child is on different branch: | |
628 | |
629 $ hg init p | |
630 $ cd p | |
631 $ hg branch A | |
632 marked working directory as branch A | |
633 $ echo a0 >a | |
634 $ hg ci -Ama0 | |
635 adding a | |
636 $ echo a1 >a | |
637 $ hg ci -ma1 | |
638 $ hg up null | |
639 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
640 $ hg branch B | |
641 marked working directory as branch B | |
642 $ echo b0 >b | |
643 $ hg ci -Amb0 | |
644 adding b | |
645 $ echo b1 >b | |
646 $ hg ci -mb1 | |
647 | |
648 $ hg clone . inner | |
649 updating to branch B | |
650 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
10771
01f097c4ae66
push: fix bug in prepush logic and its tests
Sune Foldager <cryo@cyanite.org>
parents:
10354
diff
changeset
|
651 |
12279 | 652 $ hg up A |
653 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
654 $ hg branch -f B | |
655 marked working directory as branch B | |
656 $ echo a3 >a | |
657 $ hg ci -ma3 | |
658 created new head | |
659 $ hg up 3 | |
660 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
661 $ hg branch -f A | |
662 marked working directory as branch A | |
663 $ echo b3 >b | |
664 $ hg ci -mb3 | |
665 created new head | |
10909
29a83fb8c067
prepush: add more test cases
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
10908
diff
changeset
|
666 |
12279 | 667 glog of local: |
668 | |
669 $ hg glog --template "{rev}: {branches} {desc}\n" | |
670 @ 5: A b3 | |
671 | | |
672 | o 4: B a3 | |
673 | | | |
674 o | 3: B b1 | |
675 | | | |
676 o | 2: B b0 | |
677 / | |
678 o 1: A a1 | |
679 | | |
680 o 0: A a0 | |
681 | |
682 glog of remote: | |
10909
29a83fb8c067
prepush: add more test cases
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
10908
diff
changeset
|
683 |
12279 | 684 $ hg glog -R inner --template "{rev}: {branches} {desc}\n" |
685 @ 3: B b1 | |
686 | | |
687 o 2: B b0 | |
688 | |
689 o 1: A a1 | |
690 | | |
691 o 0: A a0 | |
692 | |
693 outgoing: | |
694 | |
695 $ hg out inner --template "{rev}: {branches} {desc}\n" | |
696 comparing with inner | |
697 searching for changes | |
698 4: B a3 | |
699 5: A b3 | |
10909
29a83fb8c067
prepush: add more test cases
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
10908
diff
changeset
|
700 |
12279 | 701 $ hg push inner |
702 pushing to inner | |
703 searching for changes | |
704 abort: push creates new remote heads on branch 'A'! | |
705 (did you forget to merge? use push -f to force) | |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
706 [255] |
10909
29a83fb8c067
prepush: add more test cases
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
10908
diff
changeset
|
707 |
12279 | 708 $ hg push inner -r4 -r5 |
709 pushing to inner | |
710 searching for changes | |
711 abort: push creates new remote heads on branch 'A'! | |
712 (did you forget to merge? use push -f to force) | |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
713 [255] |
12279 | 714 |
715 $ hg in inner | |
716 comparing with inner | |
717 searching for changes | |
718 no changes found | |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
719 [1] |