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