Mercurial > hg
annotate tests/test-fetch.t @ 12664:545ec1775021
merge: handle no file parent in backwards merge (issue2364)
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 09 Oct 2010 14:50:20 -0500 |
parents | d08bb64888bc |
children | b885f28fa4fa |
rev | line source |
---|---|
12426 | 1 adjust to non-default HGPORT, e.g. with run-tests.py -j |
2822
4f7abf341cd4
fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
2 |
12426 | 3 $ echo "[extensions]" >> $HGRCPATH |
4 $ echo "fetch=" >> $HGRCPATH | |
6246
35bf9c23e17a
adjust test-fetch output to non-default HGPORT, e.g. with run-tests.py -j
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6235
diff
changeset
|
5 |
12426 | 6 test fetch with default branches only |
2822
4f7abf341cd4
fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
7 |
12426 | 8 $ hg init a |
9 $ echo a > a/a | |
10 $ hg --cwd a commit -d '1 0' -Ama | |
11 adding a | |
12 $ hg clone a b | |
13 updating to branch default | |
14 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
15 $ hg clone a c | |
16 updating to branch default | |
17 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
18 $ echo b > a/b | |
19 $ hg --cwd a commit -d '2 0' -Amb | |
20 adding b | |
21 $ hg --cwd a parents -q | |
22 1:97d72e5f12c7 | |
2822
4f7abf341cd4
fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
23 |
12426 | 24 should pull one change |
2822
4f7abf341cd4
fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
25 |
12426 | 26 $ hg --cwd b fetch ../a |
27 pulling from ../a | |
28 searching for changes | |
29 adding changesets | |
30 adding manifests | |
31 adding file changes | |
32 added 1 changesets with 1 changes to 1 files | |
33 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
34 $ hg --cwd b parents -q | |
35 1:97d72e5f12c7 | |
36 $ echo c > c/c | |
37 $ hg --cwd c commit -d '3 0' -Amc | |
38 adding c | |
39 $ hg clone c d | |
40 updating to branch default | |
41 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
42 $ hg clone c e | |
43 updating to branch default | |
44 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
2822
4f7abf341cd4
fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
45 |
12426 | 46 We cannot use the default commit message if fetching from a local |
47 repo, because the path of the repo will be included in the commit | |
48 message, making every commit appear different. | |
49 should merge c into a | |
5798
86f5d8f608b7
fetch: hide authentication details
Bryan O'Sullivan <bos@serpentine.com>
parents:
2990
diff
changeset
|
50 |
12426 | 51 $ hg --cwd c fetch -d '4 0' -m 'automated merge' ../a |
52 pulling from ../a | |
53 searching for changes | |
54 adding changesets | |
55 adding manifests | |
56 adding file changes | |
57 added 1 changesets with 1 changes to 1 files (+1 heads) | |
58 updating to 2:97d72e5f12c7 | |
59 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
60 merging with 1:5e056962225c | |
61 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
62 new changeset 3:cd3a41621cf0 merges remote changes with local | |
63 $ ls c | |
64 a | |
65 b | |
66 c | |
67 $ netstat -tnap 2>/dev/null | grep $HGPORT | grep LISTEN | |
68 [1] | |
69 $ hg --cwd a serve -a localhost -p $HGPORT -d --pid-file=hg.pid | |
70 $ cat a/hg.pid >> "$DAEMON_PIDS" | |
5798
86f5d8f608b7
fetch: hide authentication details
Bryan O'Sullivan <bos@serpentine.com>
parents:
2990
diff
changeset
|
71 |
12426 | 72 fetch over http, no auth |
5798
86f5d8f608b7
fetch: hide authentication details
Bryan O'Sullivan <bos@serpentine.com>
parents:
2990
diff
changeset
|
73 |
12426 | 74 $ hg --cwd d fetch -d '5 0' http://localhost:$HGPORT/ |
12643
d08bb64888bc
tests: reintroduce ":$HGPORT" in test output
Mads Kiilerich <mads@kiilerich.com>
parents:
12535
diff
changeset
|
75 pulling from http://localhost:$HGPORT/ |
12426 | 76 searching for changes |
77 adding changesets | |
78 adding manifests | |
79 adding file changes | |
80 added 1 changesets with 1 changes to 1 files (+1 heads) | |
81 updating to 2:97d72e5f12c7 | |
82 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
83 merging with 1:5e056962225c | |
84 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
12535
975ec4ce961c
tests: fix test-fetch port number variability
Matt Mackall <mpm@selenic.com>
parents:
12426
diff
changeset
|
85 new changeset 3:* merges remote changes with local (glob) |
12426 | 86 $ hg --cwd d tip --template '{desc}\n' |
12643
d08bb64888bc
tests: reintroduce ":$HGPORT" in test output
Mads Kiilerich <mads@kiilerich.com>
parents:
12535
diff
changeset
|
87 Automated merge with http://localhost:$HGPORT/ |
6206
0b6f12495276
fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents:
5798
diff
changeset
|
88 |
12426 | 89 fetch over http with auth (should be hidden in desc) |
6206
0b6f12495276
fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents:
5798
diff
changeset
|
90 |
12426 | 91 $ hg --cwd e fetch -d '5 0' http://user:password@localhost:$HGPORT/ |
12643
d08bb64888bc
tests: reintroduce ":$HGPORT" in test output
Mads Kiilerich <mads@kiilerich.com>
parents:
12535
diff
changeset
|
92 pulling from http://user:***@localhost:$HGPORT/ |
12426 | 93 searching for changes |
94 adding changesets | |
95 adding manifests | |
96 adding file changes | |
97 added 1 changesets with 1 changes to 1 files (+1 heads) | |
98 updating to 2:97d72e5f12c7 | |
99 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
100 merging with 1:5e056962225c | |
101 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
12535
975ec4ce961c
tests: fix test-fetch port number variability
Matt Mackall <mpm@selenic.com>
parents:
12426
diff
changeset
|
102 new changeset 3:* merges remote changes with local (glob) |
12426 | 103 $ hg --cwd e tip --template '{desc}\n' |
12643
d08bb64888bc
tests: reintroduce ":$HGPORT" in test output
Mads Kiilerich <mads@kiilerich.com>
parents:
12535
diff
changeset
|
104 Automated merge with http://localhost:$HGPORT/ |
12426 | 105 $ hg clone a f |
106 updating to branch default | |
107 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
108 $ hg clone a g | |
109 updating to branch default | |
110 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
111 $ echo f > f/f | |
112 $ hg --cwd f ci -d '6 0' -Amf | |
113 adding f | |
114 $ echo g > g/g | |
115 $ hg --cwd g ci -d '6 0' -Amg | |
116 adding g | |
117 $ hg clone -q f h | |
118 $ hg clone -q g i | |
6206
0b6f12495276
fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents:
5798
diff
changeset
|
119 |
12426 | 120 should merge f into g |
6226
bd61e44eb2cc
fetch: don't proceed if working directory is missing files (issue988)
Bryan O'Sullivan <bos@serpentine.com>
parents:
6207
diff
changeset
|
121 |
12426 | 122 $ hg --cwd g fetch -d '7 0' --switch -m 'automated merge' ../f |
123 pulling from ../f | |
124 searching for changes | |
125 adding changesets | |
126 adding manifests | |
127 adding file changes | |
128 added 1 changesets with 1 changes to 1 files (+1 heads) | |
129 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
130 merging with 3:cc6a3744834d | |
131 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
132 new changeset 4:55aa4f32ec59 merges remote changes with local | |
133 $ rm i/g | |
6226
bd61e44eb2cc
fetch: don't proceed if working directory is missing files (issue988)
Bryan O'Sullivan <bos@serpentine.com>
parents:
6207
diff
changeset
|
134 |
12426 | 135 should abort, because i is modified |
6235
d16798000be0
test-fetch failed due to non-zero exit code
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6226
diff
changeset
|
136 |
12426 | 137 $ hg --cwd i fetch ../h |
138 abort: working directory is missing some files | |
139 [255] | |
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6246
diff
changeset
|
140 |
12426 | 141 test fetch with named branches |
142 | |
143 $ hg init nbase | |
144 $ echo base > nbase/a | |
145 $ hg -R nbase ci -d '1 0' -Am base | |
146 adding a | |
147 $ hg -R nbase branch a | |
148 marked working directory as branch a | |
149 $ echo a > nbase/a | |
150 $ hg -R nbase ci -d '2 0' -m a | |
151 $ hg -R nbase up -C 0 | |
152 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
153 $ hg -R nbase branch b | |
154 marked working directory as branch b | |
155 $ echo b > nbase/b | |
156 $ hg -R nbase ci -Ad '3 0' -m b | |
157 adding b | |
158 $ echo | |
159 | |
160 | |
161 pull in change on foreign branch | |
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6246
diff
changeset
|
162 |
12426 | 163 $ hg clone nbase n1 |
164 updating to branch default | |
165 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
166 $ hg clone nbase n2 | |
167 updating to branch default | |
168 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
169 $ hg -R n1 up -C a | |
170 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
171 $ echo aa > n1/a | |
172 $ hg -R n1 ci -d '4 0' -m a1 | |
173 $ hg -R n2 up -C b | |
174 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
175 $ hg -R n2 fetch -d '9 0' -m 'merge' n1 | |
176 pulling from n1 | |
177 searching for changes | |
178 adding changesets | |
179 adding manifests | |
180 adding file changes | |
181 added 1 changesets with 1 changes to 1 files | |
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6246
diff
changeset
|
182 |
12426 | 183 parent should be 2 (no automatic update) |
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6246
diff
changeset
|
184 |
12426 | 185 $ hg -R n2 parents --template '{rev}\n' |
186 2 | |
187 $ rm -fr n1 n2 | |
188 $ echo | |
189 | |
190 | |
191 pull in changes on both foreign and local branches | |
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6246
diff
changeset
|
192 |
12426 | 193 $ hg clone nbase n1 |
194 updating to branch default | |
195 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
196 $ hg clone nbase n2 | |
197 updating to branch default | |
198 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
199 $ hg -R n1 up -C a | |
200 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
201 $ echo aa > n1/a | |
202 $ hg -R n1 ci -d '4 0' -m a1 | |
203 $ hg -R n1 up -C b | |
204 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
205 $ echo bb > n1/b | |
206 $ hg -R n1 ci -d '5 0' -m b1 | |
207 $ hg -R n2 up -C b | |
208 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
209 $ hg -R n2 fetch -d '9 0' -m 'merge' n1 | |
210 pulling from n1 | |
211 searching for changes | |
212 adding changesets | |
213 adding manifests | |
214 adding file changes | |
215 added 2 changesets with 2 changes to 2 files | |
216 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6246
diff
changeset
|
217 |
12426 | 218 parent should be 4 (fast forward) |
219 | |
220 $ hg -R n2 parents --template '{rev}\n' | |
221 4 | |
222 $ rm -fr n1 n2 | |
223 $ echo | |
224 | |
225 | |
226 pull changes on foreign (2 new heads) and local (1 new head) branches | |
227 with a local change | |
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6246
diff
changeset
|
228 |
12426 | 229 $ hg clone nbase n1 |
230 updating to branch default | |
231 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
232 $ hg clone nbase n2 | |
233 updating to branch default | |
234 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
235 $ hg -R n1 up -C a | |
236 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
237 $ echo a1 > n1/a | |
238 $ hg -R n1 ci -d '4 0' -m a1 | |
239 $ hg -R n1 up -C b | |
240 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
241 $ echo bb > n1/b | |
242 $ hg -R n1 ci -d '5 0' -m b1 | |
243 $ hg -R n1 up -C 1 | |
244 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
245 $ echo a2 > n1/a | |
246 $ hg -R n1 ci -d '6 0' -m a2 | |
247 created new head | |
248 $ hg -R n2 up -C b | |
249 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
250 $ echo change >> n2/c | |
251 $ hg -R n2 ci -Ad '7 0' -m local | |
252 adding c | |
253 $ hg -R n2 fetch -d '9 0' -m 'merge' n1 | |
254 pulling from n1 | |
255 searching for changes | |
256 adding changesets | |
257 adding manifests | |
258 adding file changes | |
259 added 3 changesets with 3 changes to 2 files (+2 heads) | |
260 updating to 5:708c6cce3d26 | |
261 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
262 merging with 3:d83427717b1f | |
263 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
264 new changeset 7:48f1a33f52af merges remote changes with local | |
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6246
diff
changeset
|
265 |
12426 | 266 parent should be 7 (new merge changeset) |
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6246
diff
changeset
|
267 |
12426 | 268 $ hg -R n2 parents --template '{rev}\n' |
269 7 | |
270 $ rm -fr n1 n2 | |
271 | |
272 pull in changes on foreign (merge of local branch) and local (2 new | |
273 heads) with a local change | |
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6246
diff
changeset
|
274 |
12426 | 275 $ hg clone nbase n1 |
276 updating to branch default | |
277 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
278 $ hg clone nbase n2 | |
279 updating to branch default | |
280 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
281 $ hg -R n1 up -C a | |
282 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
283 $ hg -R n1 merge b | |
284 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
285 (branch merge, don't forget to commit) | |
286 $ hg -R n1 ci -d '4 0' -m merge | |
287 $ hg -R n1 up -C 2 | |
288 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
289 $ echo c > n1/a | |
290 $ hg -R n1 ci -d '5 0' -m c | |
291 $ hg -R n1 up -C 2 | |
292 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
293 $ echo cc > n1/a | |
294 $ hg -R n1 ci -d '6 0' -m cc | |
295 created new head | |
296 $ hg -R n2 up -C b | |
297 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
298 $ echo change >> n2/b | |
299 $ hg -R n2 ci -Ad '7 0' -m local | |
300 $ hg -R n2 fetch -d '9 0' -m 'merge' n1 | |
301 pulling from n1 | |
302 searching for changes | |
303 adding changesets | |
304 adding manifests | |
305 adding file changes | |
306 added 3 changesets with 2 changes to 1 files (+2 heads) | |
307 not merging with 1 other new branch heads (use "hg heads ." and "hg merge" to merge them) | |
7049
6489ee64b522
fetch: use dirstate branch instead of first parents
Sune Foldager <cryo@cyanite.org>
parents:
7007
diff
changeset
|
308 |
12426 | 309 parent should be 3 (fetch did not merge anything) |
310 | |
311 $ hg -R n2 parents --template '{rev}\n' | |
312 3 | |
313 $ rm -fr n1 n2 | |
314 | |
315 pull in change on different branch than dirstate | |
316 | |
317 $ hg init n1 | |
318 $ echo a > n1/a | |
319 $ hg -R n1 ci -Am initial | |
320 adding a | |
321 $ hg clone n1 n2 | |
322 updating to branch default | |
323 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
324 $ echo b > n1/a | |
325 $ hg -R n1 ci -m next | |
326 $ hg -R n2 branch topic | |
327 marked working directory as branch topic | |
328 $ hg -R n2 fetch -d '0 0' -m merge n1 | |
329 abort: working dir not at branch tip (use "hg update" to check out branch tip) | |
330 [255] | |
331 | |
332 parent should be 0 (fetch did not update or merge anything) | |
333 | |
334 $ hg -R n2 parents --template '{rev}\n' | |
335 0 | |
336 $ rm -fr n1 n2 | |
337 | |
338 test fetch with inactive branches | |
7855
aa1a87f7544f
regression test for issue1552
Benjamin Pollack <benjamin@bitquabit.com>
parents:
7344
diff
changeset
|
339 |
12426 | 340 $ hg init ib1 |
341 $ echo a > ib1/a | |
342 $ hg --cwd ib1 ci -Am base | |
343 adding a | |
344 $ hg --cwd ib1 branch second | |
345 marked working directory as branch second | |
346 $ echo b > ib1/b | |
347 $ hg --cwd ib1 ci -Am onsecond | |
348 adding b | |
349 $ hg --cwd ib1 branch -f default | |
350 marked working directory as branch default | |
351 $ echo c > ib1/c | |
352 $ hg --cwd ib1 ci -Am newdefault | |
353 adding c | |
354 created new head | |
355 $ hg clone ib1 ib2 | |
356 updating to branch default | |
357 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
358 | |
359 fetch should succeed | |
360 | |
361 $ hg --cwd ib2 fetch ../ib1 | |
362 pulling from ../ib1 | |
363 searching for changes | |
364 no changes found | |
365 $ rm -fr ib1 ib2 | |
366 | |
367 test issue1726 | |
9093
0b2b269ba3d0
branch heads: fix regression introduced in e67e5b60e55f (issue1726)
Henrik Stuart <hg@hstuart.dk>
parents:
7855
diff
changeset
|
368 |
12426 | 369 $ hg init i1726r1 |
370 $ echo a > i1726r1/a | |
371 $ hg --cwd i1726r1 ci -Am base | |
372 adding a | |
373 $ hg clone i1726r1 i1726r2 | |
374 updating to branch default | |
375 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
376 $ echo b > i1726r1/a | |
377 $ hg --cwd i1726r1 ci -m second | |
378 $ echo c > i1726r2/a | |
379 $ hg --cwd i1726r2 ci -m third | |
380 $ HGMERGE=true hg --cwd i1726r2 fetch ../i1726r1 | |
381 pulling from ../i1726r1 | |
382 searching for changes | |
383 adding changesets | |
384 adding manifests | |
385 adding file changes | |
386 added 1 changesets with 1 changes to 1 files (+1 heads) | |
387 updating to 2:7837755a2789 | |
388 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
389 merging with 1:d1f0c6c48ebd | |
390 merging a | |
391 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
392 new changeset 3:* merges remote changes with local (glob) | |
393 $ hg --cwd i1726r2 heads default --template '{rev}\n' | |
394 3 | |
395 $ echo | |
396 | |
10580
612c142b7a82
fetch: fix newheads calculation (issue2047)
Sune Foldager <cryo@cyanite.org>
parents:
10398
diff
changeset
|
397 |
12426 | 398 test issue2047 |
7344
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
7049
diff
changeset
|
399 |
12426 | 400 $ hg -q init i2047a |
401 $ cd i2047a | |
402 $ echo a > a | |
403 $ hg -q ci -Am a | |
404 $ hg -q branch stable | |
405 $ echo b > b | |
406 $ hg -q ci -Am b | |
407 $ cd .. | |
408 $ hg -q clone -r 0 i2047a i2047b | |
409 $ cd i2047b | |
410 $ hg fetch ../i2047a | |
411 pulling from ../i2047a | |
412 searching for changes | |
413 adding changesets | |
414 adding manifests | |
415 adding file changes | |
416 added 1 changesets with 1 changes to 1 files | |
417 $ "$TESTDIR/killdaemons.py" |