##// END OF EJS Templates
tests: roll test-clone-failure.t into test-clone.t
Adrian Buehlmann -
r16847:cda5402b default
parent child Browse files
Show More
@@ -1,460 +1,558 b''
1 1 Prepare repo a:
2 2
3 3 $ hg init a
4 4 $ cd a
5 5 $ echo a > a
6 6 $ hg add a
7 7 $ hg commit -m test
8 8 $ echo first line > b
9 9 $ hg add b
10 10
11 11 Create a non-inlined filelog:
12 12
13 13 $ python -c 'file("data1", "wb").write("".join("%s\n" % x for x in range(10000)))'
14 14 $ for j in 0 1 2 3 4 5 6 7 8 9; do
15 15 > cat data1 >> b
16 16 > hg commit -m test
17 17 > done
18 18
19 19 List files in store/data (should show a 'b.d'):
20 20
21 21 $ for i in .hg/store/data/*; do
22 22 > echo $i
23 23 > done
24 24 .hg/store/data/a.i
25 25 .hg/store/data/b.d
26 26 .hg/store/data/b.i
27 27
28 28 Default operation:
29 29
30 30 $ hg clone . ../b
31 31 updating to branch default
32 32 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
33 33 $ cd ../b
34 34 $ cat a
35 35 a
36 36 $ hg verify
37 37 checking changesets
38 38 checking manifests
39 39 crosschecking files in changesets and manifests
40 40 checking files
41 41 2 files, 11 changesets, 11 total revisions
42 42
43 43 Invalid dest '' must abort:
44 44
45 45 $ hg clone . ''
46 46 abort: * (glob)
47 47 [255]
48 48
49 49 No update, with debug option:
50 50
51 51 $ hg --debug clone -U . ../c
52 52 linked 8 files
53 53 $ cd ../c
54 54 $ cat a 2>/dev/null || echo "a not present"
55 55 a not present
56 56 $ hg verify
57 57 checking changesets
58 58 checking manifests
59 59 crosschecking files in changesets and manifests
60 60 checking files
61 61 2 files, 11 changesets, 11 total revisions
62 62
63 63 Default destination:
64 64
65 65 $ mkdir ../d
66 66 $ cd ../d
67 67 $ hg clone ../a
68 68 destination directory: a
69 69 updating to branch default
70 70 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
71 71 $ cd a
72 72 $ hg cat a
73 73 a
74 74 $ cd ../..
75 75
76 76 Check that we drop the 'file:' from the path before writing the .hgrc:
77 77
78 78 $ hg clone file:a e
79 79 updating to branch default
80 80 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
81 81 $ grep 'file:' e/.hg/hgrc
82 82 [1]
83 83
84 84 Check that path aliases are expanded:
85 85
86 86 $ hg clone -q -U --config 'paths.foobar=a#0' foobar f
87 87 $ hg -R f showconfig paths.default
88 88 $TESTTMP/a#0 (glob)
89 89
90 90 Use --pull:
91 91
92 92 $ hg clone --pull a g
93 93 requesting all changes
94 94 adding changesets
95 95 adding manifests
96 96 adding file changes
97 97 added 11 changesets with 11 changes to 2 files
98 98 updating to branch default
99 99 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
100 100 $ hg -R g verify
101 101 checking changesets
102 102 checking manifests
103 103 crosschecking files in changesets and manifests
104 104 checking files
105 105 2 files, 11 changesets, 11 total revisions
106 106
107 107 Invalid dest '' with --pull must abort (issue2528):
108 108
109 109 $ hg clone --pull a ''
110 110 abort: * (glob)
111 111 [255]
112 112
113 113 Clone to '.':
114 114
115 115 $ mkdir h
116 116 $ cd h
117 117 $ hg clone ../a .
118 118 updating to branch default
119 119 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
120 120 $ cd ..
121 121
122 122
123 123 *** Tests for option -u ***
124 124
125 125 Adding some more history to repo a:
126 126
127 127 $ cd a
128 128 $ hg tag ref1
129 129 $ echo the quick brown fox >a
130 130 $ hg ci -m "hacked default"
131 131 $ hg up ref1
132 132 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
133 133 $ hg branch stable
134 134 marked working directory as branch stable
135 135 (branches are permanent and global, did you want a bookmark?)
136 136 $ echo some text >a
137 137 $ hg ci -m "starting branch stable"
138 138 $ hg tag ref2
139 139 $ echo some more text >a
140 140 $ hg ci -m "another change for branch stable"
141 141 $ hg up ref2
142 142 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
143 143 $ hg parents
144 144 changeset: 13:e8ece76546a6
145 145 branch: stable
146 146 tag: ref2
147 147 parent: 10:a7949464abda
148 148 user: test
149 149 date: Thu Jan 01 00:00:00 1970 +0000
150 150 summary: starting branch stable
151 151
152 152
153 153 Repo a has two heads:
154 154
155 155 $ hg heads
156 156 changeset: 15:0aae7cf88f0d
157 157 branch: stable
158 158 tag: tip
159 159 user: test
160 160 date: Thu Jan 01 00:00:00 1970 +0000
161 161 summary: another change for branch stable
162 162
163 163 changeset: 12:f21241060d6a
164 164 user: test
165 165 date: Thu Jan 01 00:00:00 1970 +0000
166 166 summary: hacked default
167 167
168 168
169 169 $ cd ..
170 170
171 171
172 172 Testing --noupdate with --updaterev (must abort):
173 173
174 174 $ hg clone --noupdate --updaterev 1 a ua
175 175 abort: cannot specify both --noupdate and --updaterev
176 176 [255]
177 177
178 178
179 179 Testing clone -u:
180 180
181 181 $ hg clone -u . a ua
182 182 updating to branch stable
183 183 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
184 184
185 185 Repo ua has both heads:
186 186
187 187 $ hg -R ua heads
188 188 changeset: 15:0aae7cf88f0d
189 189 branch: stable
190 190 tag: tip
191 191 user: test
192 192 date: Thu Jan 01 00:00:00 1970 +0000
193 193 summary: another change for branch stable
194 194
195 195 changeset: 12:f21241060d6a
196 196 user: test
197 197 date: Thu Jan 01 00:00:00 1970 +0000
198 198 summary: hacked default
199 199
200 200
201 201 Same revision checked out in repo a and ua:
202 202
203 203 $ hg -R a parents --template "{node|short}\n"
204 204 e8ece76546a6
205 205 $ hg -R ua parents --template "{node|short}\n"
206 206 e8ece76546a6
207 207
208 208 $ rm -r ua
209 209
210 210
211 211 Testing clone --pull -u:
212 212
213 213 $ hg clone --pull -u . a ua
214 214 requesting all changes
215 215 adding changesets
216 216 adding manifests
217 217 adding file changes
218 218 added 16 changesets with 16 changes to 3 files (+1 heads)
219 219 updating to branch stable
220 220 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
221 221
222 222 Repo ua has both heads:
223 223
224 224 $ hg -R ua heads
225 225 changeset: 15:0aae7cf88f0d
226 226 branch: stable
227 227 tag: tip
228 228 user: test
229 229 date: Thu Jan 01 00:00:00 1970 +0000
230 230 summary: another change for branch stable
231 231
232 232 changeset: 12:f21241060d6a
233 233 user: test
234 234 date: Thu Jan 01 00:00:00 1970 +0000
235 235 summary: hacked default
236 236
237 237
238 238 Same revision checked out in repo a and ua:
239 239
240 240 $ hg -R a parents --template "{node|short}\n"
241 241 e8ece76546a6
242 242 $ hg -R ua parents --template "{node|short}\n"
243 243 e8ece76546a6
244 244
245 245 $ rm -r ua
246 246
247 247
248 248 Testing clone -u <branch>:
249 249
250 250 $ hg clone -u stable a ua
251 251 updating to branch stable
252 252 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
253 253
254 254 Repo ua has both heads:
255 255
256 256 $ hg -R ua heads
257 257 changeset: 15:0aae7cf88f0d
258 258 branch: stable
259 259 tag: tip
260 260 user: test
261 261 date: Thu Jan 01 00:00:00 1970 +0000
262 262 summary: another change for branch stable
263 263
264 264 changeset: 12:f21241060d6a
265 265 user: test
266 266 date: Thu Jan 01 00:00:00 1970 +0000
267 267 summary: hacked default
268 268
269 269
270 270 Branch 'stable' is checked out:
271 271
272 272 $ hg -R ua parents
273 273 changeset: 15:0aae7cf88f0d
274 274 branch: stable
275 275 tag: tip
276 276 user: test
277 277 date: Thu Jan 01 00:00:00 1970 +0000
278 278 summary: another change for branch stable
279 279
280 280
281 281 $ rm -r ua
282 282
283 283
284 284 Testing default checkout:
285 285
286 286 $ hg clone a ua
287 287 updating to branch default
288 288 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
289 289
290 290 Repo ua has both heads:
291 291
292 292 $ hg -R ua heads
293 293 changeset: 15:0aae7cf88f0d
294 294 branch: stable
295 295 tag: tip
296 296 user: test
297 297 date: Thu Jan 01 00:00:00 1970 +0000
298 298 summary: another change for branch stable
299 299
300 300 changeset: 12:f21241060d6a
301 301 user: test
302 302 date: Thu Jan 01 00:00:00 1970 +0000
303 303 summary: hacked default
304 304
305 305
306 306 Branch 'default' is checked out:
307 307
308 308 $ hg -R ua parents
309 309 changeset: 12:f21241060d6a
310 310 user: test
311 311 date: Thu Jan 01 00:00:00 1970 +0000
312 312 summary: hacked default
313 313
314 314
315 315 $ rm -r ua
316 316
317 317
318 318 Testing #<branch>:
319 319
320 320 $ hg clone -u . a#stable ua
321 321 adding changesets
322 322 adding manifests
323 323 adding file changes
324 324 added 14 changesets with 14 changes to 3 files
325 325 updating to branch stable
326 326 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
327 327
328 328 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
329 329
330 330 $ hg -R ua heads
331 331 changeset: 13:0aae7cf88f0d
332 332 branch: stable
333 333 tag: tip
334 334 user: test
335 335 date: Thu Jan 01 00:00:00 1970 +0000
336 336 summary: another change for branch stable
337 337
338 338 changeset: 10:a7949464abda
339 339 user: test
340 340 date: Thu Jan 01 00:00:00 1970 +0000
341 341 summary: test
342 342
343 343
344 344 Same revision checked out in repo a and ua:
345 345
346 346 $ hg -R a parents --template "{node|short}\n"
347 347 e8ece76546a6
348 348 $ hg -R ua parents --template "{node|short}\n"
349 349 e8ece76546a6
350 350
351 351 $ rm -r ua
352 352
353 353
354 354 Testing -u -r <branch>:
355 355
356 356 $ hg clone -u . -r stable a ua
357 357 adding changesets
358 358 adding manifests
359 359 adding file changes
360 360 added 14 changesets with 14 changes to 3 files
361 361 updating to branch stable
362 362 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
363 363
364 364 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
365 365
366 366 $ hg -R ua heads
367 367 changeset: 13:0aae7cf88f0d
368 368 branch: stable
369 369 tag: tip
370 370 user: test
371 371 date: Thu Jan 01 00:00:00 1970 +0000
372 372 summary: another change for branch stable
373 373
374 374 changeset: 10:a7949464abda
375 375 user: test
376 376 date: Thu Jan 01 00:00:00 1970 +0000
377 377 summary: test
378 378
379 379
380 380 Same revision checked out in repo a and ua:
381 381
382 382 $ hg -R a parents --template "{node|short}\n"
383 383 e8ece76546a6
384 384 $ hg -R ua parents --template "{node|short}\n"
385 385 e8ece76546a6
386 386
387 387 $ rm -r ua
388 388
389 389
390 390 Testing -r <branch>:
391 391
392 392 $ hg clone -r stable a ua
393 393 adding changesets
394 394 adding manifests
395 395 adding file changes
396 396 added 14 changesets with 14 changes to 3 files
397 397 updating to branch stable
398 398 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
399 399
400 400 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
401 401
402 402 $ hg -R ua heads
403 403 changeset: 13:0aae7cf88f0d
404 404 branch: stable
405 405 tag: tip
406 406 user: test
407 407 date: Thu Jan 01 00:00:00 1970 +0000
408 408 summary: another change for branch stable
409 409
410 410 changeset: 10:a7949464abda
411 411 user: test
412 412 date: Thu Jan 01 00:00:00 1970 +0000
413 413 summary: test
414 414
415 415
416 416 Branch 'stable' is checked out:
417 417
418 418 $ hg -R ua parents
419 419 changeset: 13:0aae7cf88f0d
420 420 branch: stable
421 421 tag: tip
422 422 user: test
423 423 date: Thu Jan 01 00:00:00 1970 +0000
424 424 summary: another change for branch stable
425 425
426 426
427 427 $ rm -r ua
428 428
429 429
430 430 Issue2267: Error in 1.6 hg.py: TypeError: 'NoneType' object is not
431 431 iterable in addbranchrevs()
432 432
433 433 $ cat <<EOF > simpleclone.py
434 434 > from mercurial import ui, hg
435 435 > myui = ui.ui()
436 436 > repo = hg.repository(myui, 'a')
437 437 > hg.clone(myui, {}, repo, dest="ua")
438 438 > EOF
439 439
440 440 $ python simpleclone.py
441 441 updating to branch default
442 442 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
443 443
444 444 $ rm -r ua
445 445
446 446 $ cat <<EOF > branchclone.py
447 447 > from mercurial import ui, hg
448 448 > myui = ui.ui()
449 449 > repo = hg.repository(myui, 'a')
450 450 > hg.clone(myui, {}, repo, dest="ua", branch=["stable",])
451 451 > EOF
452 452
453 453 $ python branchclone.py
454 454 adding changesets
455 455 adding manifests
456 456 adding file changes
457 457 added 14 changesets with 14 changes to 3 files
458 458 updating to branch stable
459 459 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
460 460 $ rm -r ua
461
462
463 Testing failures:
464
465 $ mkdir fail
466 $ cd fail
467
468 No local source
469
470 $ hg clone a b
471 abort: repository a not found!
472 [255]
473
474 No remote source
475
476 $ hg clone http://127.0.0.1:3121/a b
477 abort: error: *refused* (glob)
478 [255]
479 $ rm -rf b # work around bug with http clone
480
481
482 #if unix-permissions
483
484 Inaccessible source
485
486 $ mkdir a
487 $ chmod 000 a
488 $ hg clone a b
489 abort: repository a not found!
490 [255]
491
492 Inaccessible destination
493
494 $ hg init b
495 $ cd b
496 $ hg clone . ../a
497 abort: Permission denied: ../a
498 [255]
499 $ cd ..
500 $ chmod 700 a
501 $ rm -r a b
502
503 #endif
504
505
506 Source of wrong type
507
508 $ if "$TESTDIR/hghave" -q fifo; then
509 > mkfifo a
510 > hg clone a b
511 > rm a
512 > else
513 > echo "abort: repository a not found!"
514 > fi
515 abort: repository a not found!
516
517 Default destination, same directory
518
519 $ hg init q
520 $ hg clone q
521 destination directory: q
522 abort: destination 'q' is not empty
523 [255]
524
525 destination directory not empty
526
527 $ mkdir a
528 $ echo stuff > a/a
529 $ hg clone q a
530 abort: destination 'a' is not empty
531 [255]
532
533
534 #if unix-permissions
535
536 leave existing directory in place after clone failure
537
538 $ hg init c
539 $ cd c
540 $ echo c > c
541 $ hg commit -A -m test
542 adding c
543 $ chmod -rx .hg/store/data
544 $ cd ..
545 $ mkdir d
546 $ hg clone c d 2> err
547 [255]
548 $ test -d d
549 $ test -d d/.hg
550 [1]
551
552 reenable perm to allow deletion
553
554 $ chmod +rx c/.hg/store/data
555
556 #endif
557
558 $ cd ..
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now