| 1 |
#testcases fncache fileindex |
| 2 |
|
| 3 |
#if fileindex |
| 4 |
$ cat >> $HGRCPATH << EOF |
| 5 |
> [format] |
| 6 |
> use-fileindex-v1=yes |
| 7 |
> EOF |
| 8 |
#else |
| 9 |
$ cat >> $HGRCPATH << EOF |
| 10 |
> [format] |
| 11 |
> use-fileindex-v1=no |
| 12 |
> EOF |
| 13 |
#endif |
| 14 |
|
| 15 |
#if fileindex no-rust |
| 16 |
$ cat >> $HGRCPATH << EOF |
| 17 |
> [storage] |
| 18 |
> fileindex.slow-path=allow |
| 19 |
> EOF |
| 20 |
#endif |
| 21 |
|
| 22 |
Prepare repo a: |
| 23 |
|
| 24 |
$ hg init a |
| 25 |
$ cd a |
| 26 |
$ echo a > a |
| 27 |
$ hg add a |
| 28 |
$ hg commit -m test |
| 29 |
$ echo first line > b |
| 30 |
$ hg add b |
| 31 |
|
| 32 |
Create a non-inlined filelog: |
| 33 |
|
| 34 |
$ "$PYTHON" -c 'open("data1", "wb").write(b"".join(b"%d\n" % x for x in range(10000)))' |
| 35 |
$ for j in 0 1 2 3 4 5 6 7 8 9; do |
| 36 |
> cat data1 >> b |
| 37 |
> hg commit -m test |
| 38 |
> done |
| 39 |
|
| 40 |
List files in store/data (should show a 'b.d'): |
| 41 |
|
| 42 |
$ for i in .hg/store/data/*; do |
| 43 |
> echo $i |
| 44 |
> done |
| 45 |
.hg/store/data/a.i |
| 46 |
.hg/store/data/b.d |
| 47 |
.hg/store/data/b.i |
| 48 |
|
| 49 |
Trigger branchcache creation: |
| 50 |
|
| 51 |
$ hg branches |
| 52 |
default 10:a7949464abda |
| 53 |
$ ls .hg/cache |
| 54 |
branch2-served |
| 55 |
rbc-names-v2 |
| 56 |
rbc-revs-v2 |
| 57 |
|
| 58 |
Default operation: |
| 59 |
|
| 60 |
$ hg clone . ../b |
| 61 |
updating to branch default |
| 62 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 63 |
$ cd ../b |
| 64 |
|
| 65 |
Ensure branchcache got copied over: |
| 66 |
|
| 67 |
$ ls .hg/cache |
| 68 |
branch2-base |
| 69 |
branch2-served |
| 70 |
rbc-names-v2 |
| 71 |
rbc-revs-v2 |
| 72 |
tags2 |
| 73 |
tags2-served |
| 74 |
|
| 75 |
$ cat a |
| 76 |
a |
| 77 |
$ hg verify -q |
| 78 |
|
| 79 |
Invalid dest '' must abort: |
| 80 |
|
| 81 |
$ hg clone . '' |
| 82 |
abort: empty destination path is not valid |
| 83 |
[10] |
| 84 |
|
| 85 |
No update, with debug option: |
| 86 |
|
| 87 |
#if hardlink |
| 88 |
$ hg --debug clone -U . ../c --config progress.debug=true |
| 89 |
linking: 1/12 files (8.33%) (no-rust !) |
| 90 |
linking: 2/12 files (16.67%) (no-rust !) |
| 91 |
linking: 3/12 files (25.00%) (no-rust !) |
| 92 |
linking: 4/12 files (33.33%) (no-rust !) |
| 93 |
linking: 5/12 files (41.67%) (no-rust !) |
| 94 |
linking: 6/12 files (50.00%) (no-rust !) |
| 95 |
linking: 7/12 files (58.33%) (no-rust !) |
| 96 |
linking: 8/12 files (66.67%) (no-rust !) |
| 97 |
linking: 9/12 files (75.00%) (no-rust !) |
| 98 |
linking: 10/12 files (83.33%) (no-rust !) |
| 99 |
linking: 11/12 files (91.67%) (no-rust !) |
| 100 |
linking: 12/12 files (100.00%) (no-rust !) |
| 101 |
linked 12 files (no-rust !) |
| 102 |
linking: 1/14 files (7.14%) (rust !) |
| 103 |
linking: 2/14 files (14.29%) (rust !) |
| 104 |
linking: 3/14 files (21.43%) (rust !) |
| 105 |
linking: 4/14 files (28.57%) (rust !) |
| 106 |
linking: 5/14 files (35.71%) (rust !) |
| 107 |
linking: 6/14 files (42.86%) (rust !) |
| 108 |
linking: 7/14 files (50.00%) (rust !) |
| 109 |
linking: 8/14 files (57.14%) (rust !) |
| 110 |
linking: 9/14 files (64.29%) (rust !) |
| 111 |
linking: 10/14 files (71.43%) (rust !) |
| 112 |
linking: 11/14 files (78.57%) (rust !) |
| 113 |
linking: 12/14 files (85.71%) (rust !) |
| 114 |
linking: 13/14 files (92.86%) (rust !) |
| 115 |
linking: 14/14 files (100.00%) (rust !) |
| 116 |
linked 14 files (rust !) |
| 117 |
updating the branch cache |
| 118 |
#else |
| 119 |
$ hg --debug clone -U . ../c --config progress.debug=true |
| 120 |
linking: 1 files |
| 121 |
copying: 2 files |
| 122 |
copying: 3 files |
| 123 |
copying: 4 files |
| 124 |
copying: 5 files |
| 125 |
copying: 6 files |
| 126 |
copying: 7 files |
| 127 |
copying: 8 files |
| 128 |
#endif |
| 129 |
$ cd ../c |
| 130 |
|
| 131 |
Ensure branchcache got copied over: |
| 132 |
|
| 133 |
$ ls .hg/cache |
| 134 |
branch2-base |
| 135 |
branch2-served |
| 136 |
rbc-names-v2 |
| 137 |
rbc-revs-v2 |
| 138 |
tags2 |
| 139 |
tags2-served |
| 140 |
|
| 141 |
$ cat a 2>/dev/null || echo "a not present" |
| 142 |
a not present |
| 143 |
$ hg verify -q |
| 144 |
|
| 145 |
Default destination: |
| 146 |
|
| 147 |
$ mkdir ../d |
| 148 |
$ cd ../d |
| 149 |
$ hg clone ../a |
| 150 |
destination directory: a |
| 151 |
updating to branch default |
| 152 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 153 |
$ cd a |
| 154 |
$ hg cat a |
| 155 |
a |
| 156 |
$ cd ../.. |
| 157 |
|
| 158 |
Check that we drop the 'file:' from the path before writing the .hgrc: |
| 159 |
|
| 160 |
$ hg clone file:a e |
| 161 |
updating to branch default |
| 162 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 163 |
$ grep 'file:' e/.hg/hgrc |
| 164 |
[1] |
| 165 |
|
| 166 |
Check that path aliases are expanded: |
| 167 |
|
| 168 |
$ hg clone -q -U --config 'paths.foobar=a#0' foobar f |
| 169 |
$ hg -R f showconfig paths.default |
| 170 |
$TESTTMP/a#0 |
| 171 |
|
| 172 |
Use --pull: |
| 173 |
|
| 174 |
$ hg clone --pull a g |
| 175 |
requesting all changes |
| 176 |
adding changesets |
| 177 |
adding manifests |
| 178 |
adding file changes |
| 179 |
added 11 changesets with 11 changes to 2 files |
| 180 |
new changesets acb14030fe0a:a7949464abda |
| 181 |
updating to branch default |
| 182 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 183 |
$ hg -R g verify -q |
| 184 |
|
| 185 |
Invalid dest '' with --pull must abort (issue2528): |
| 186 |
|
| 187 |
$ hg clone --pull a '' |
| 188 |
abort: empty destination path is not valid |
| 189 |
[10] |
| 190 |
|
| 191 |
Clone to '.': |
| 192 |
|
| 193 |
$ mkdir h |
| 194 |
$ cd h |
| 195 |
$ hg clone ../a . |
| 196 |
updating to branch default |
| 197 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 198 |
$ cd .. |
| 199 |
|
| 200 |
|
| 201 |
*** Tests for option -u *** |
| 202 |
|
| 203 |
Adding some more history to repo a: |
| 204 |
|
| 205 |
$ cd a |
| 206 |
$ hg tag ref1 |
| 207 |
$ echo the quick brown fox >a |
| 208 |
$ hg ci -m "hacked default" |
| 209 |
$ hg up ref1 |
| 210 |
1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 211 |
$ hg branch stable |
| 212 |
marked working directory as branch stable |
| 213 |
(branches are permanent and global, did you want a bookmark?) |
| 214 |
$ echo some text >a |
| 215 |
$ hg ci -m "starting branch stable" |
| 216 |
$ hg tag ref2 |
| 217 |
$ echo some more text >a |
| 218 |
$ hg ci -m "another change for branch stable" |
| 219 |
$ hg up ref2 |
| 220 |
1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 221 |
$ hg parents |
| 222 |
changeset: 13:e8ece76546a6 |
| 223 |
branch: stable |
| 224 |
tag: ref2 |
| 225 |
parent: 10:a7949464abda |
| 226 |
user: test |
| 227 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 228 |
summary: starting branch stable |
| 229 |
|
| 230 |
|
| 231 |
Repo a has two heads: |
| 232 |
|
| 233 |
$ hg heads |
| 234 |
changeset: 15:0aae7cf88f0d |
| 235 |
branch: stable |
| 236 |
tag: tip |
| 237 |
user: test |
| 238 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 239 |
summary: another change for branch stable |
| 240 |
|
| 241 |
changeset: 12:f21241060d6a |
| 242 |
user: test |
| 243 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 244 |
summary: hacked default |
| 245 |
|
| 246 |
|
| 247 |
$ cd .. |
| 248 |
|
| 249 |
|
| 250 |
Testing --noupdate with --updaterev (must abort): |
| 251 |
|
| 252 |
$ hg clone --noupdate --updaterev 1 a ua |
| 253 |
abort: cannot specify both --noupdate and --updaterev |
| 254 |
[10] |
| 255 |
|
| 256 |
|
| 257 |
Testing clone -u: |
| 258 |
|
| 259 |
$ hg clone -u . a ua |
| 260 |
updating to branch stable |
| 261 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 262 |
|
| 263 |
Repo ua has both heads: |
| 264 |
|
| 265 |
$ hg -R ua heads |
| 266 |
changeset: 15:0aae7cf88f0d |
| 267 |
branch: stable |
| 268 |
tag: tip |
| 269 |
user: test |
| 270 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 271 |
summary: another change for branch stable |
| 272 |
|
| 273 |
changeset: 12:f21241060d6a |
| 274 |
user: test |
| 275 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 276 |
summary: hacked default |
| 277 |
|
| 278 |
|
| 279 |
Same revision checked out in repo a and ua: |
| 280 |
|
| 281 |
$ hg -R a parents --template "{node|short}\n" |
| 282 |
e8ece76546a6 |
| 283 |
$ hg -R ua parents --template "{node|short}\n" |
| 284 |
e8ece76546a6 |
| 285 |
|
| 286 |
$ rm -r ua |
| 287 |
|
| 288 |
|
| 289 |
Testing clone --pull -u: |
| 290 |
|
| 291 |
$ hg clone --pull -u . a ua |
| 292 |
requesting all changes |
| 293 |
adding changesets |
| 294 |
adding manifests |
| 295 |
adding file changes |
| 296 |
added 16 changesets with 16 changes to 3 files (+1 heads) |
| 297 |
new changesets acb14030fe0a:0aae7cf88f0d |
| 298 |
updating to branch stable |
| 299 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 300 |
|
| 301 |
Repo ua has both heads: |
| 302 |
|
| 303 |
$ hg -R ua heads |
| 304 |
changeset: 15:0aae7cf88f0d |
| 305 |
branch: stable |
| 306 |
tag: tip |
| 307 |
user: test |
| 308 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 309 |
summary: another change for branch stable |
| 310 |
|
| 311 |
changeset: 12:f21241060d6a |
| 312 |
user: test |
| 313 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 314 |
summary: hacked default |
| 315 |
|
| 316 |
|
| 317 |
Same revision checked out in repo a and ua: |
| 318 |
|
| 319 |
$ hg -R a parents --template "{node|short}\n" |
| 320 |
e8ece76546a6 |
| 321 |
$ hg -R ua parents --template "{node|short}\n" |
| 322 |
e8ece76546a6 |
| 323 |
|
| 324 |
$ rm -r ua |
| 325 |
|
| 326 |
|
| 327 |
Testing clone -u <branch>: |
| 328 |
|
| 329 |
$ hg clone -u stable a ua |
| 330 |
updating to branch stable |
| 331 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 332 |
|
| 333 |
Repo ua has both heads: |
| 334 |
|
| 335 |
$ hg -R ua heads |
| 336 |
changeset: 15:0aae7cf88f0d |
| 337 |
branch: stable |
| 338 |
tag: tip |
| 339 |
user: test |
| 340 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 341 |
summary: another change for branch stable |
| 342 |
|
| 343 |
changeset: 12:f21241060d6a |
| 344 |
user: test |
| 345 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 346 |
summary: hacked default |
| 347 |
|
| 348 |
|
| 349 |
Branch 'stable' is checked out: |
| 350 |
|
| 351 |
$ hg -R ua parents |
| 352 |
changeset: 15:0aae7cf88f0d |
| 353 |
branch: stable |
| 354 |
tag: tip |
| 355 |
user: test |
| 356 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 357 |
summary: another change for branch stable |
| 358 |
|
| 359 |
|
| 360 |
$ rm -r ua |
| 361 |
|
| 362 |
|
| 363 |
Testing default checkout: |
| 364 |
|
| 365 |
$ hg clone a ua |
| 366 |
updating to branch default |
| 367 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 368 |
|
| 369 |
Repo ua has both heads: |
| 370 |
|
| 371 |
$ hg -R ua heads |
| 372 |
changeset: 15:0aae7cf88f0d |
| 373 |
branch: stable |
| 374 |
tag: tip |
| 375 |
user: test |
| 376 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 377 |
summary: another change for branch stable |
| 378 |
|
| 379 |
changeset: 12:f21241060d6a |
| 380 |
user: test |
| 381 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 382 |
summary: hacked default |
| 383 |
|
| 384 |
|
| 385 |
Branch 'default' is checked out: |
| 386 |
|
| 387 |
$ hg -R ua parents |
| 388 |
changeset: 12:f21241060d6a |
| 389 |
user: test |
| 390 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 391 |
summary: hacked default |
| 392 |
|
| 393 |
Test clone with a branch named "@" (issue3677) |
| 394 |
|
| 395 |
$ hg -R ua branch @ |
| 396 |
marked working directory as branch @ |
| 397 |
$ hg -R ua commit -m 'created branch @' |
| 398 |
$ hg clone ua atbranch |
| 399 |
updating to branch default |
| 400 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 401 |
$ hg -R atbranch heads |
| 402 |
changeset: 16:798b6d97153e |
| 403 |
branch: @ |
| 404 |
tag: tip |
| 405 |
parent: 12:f21241060d6a |
| 406 |
user: test |
| 407 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 408 |
summary: created branch @ |
| 409 |
|
| 410 |
changeset: 15:0aae7cf88f0d |
| 411 |
branch: stable |
| 412 |
user: test |
| 413 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 414 |
summary: another change for branch stable |
| 415 |
|
| 416 |
changeset: 12:f21241060d6a |
| 417 |
user: test |
| 418 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 419 |
summary: hacked default |
| 420 |
|
| 421 |
$ hg -R atbranch parents |
| 422 |
changeset: 12:f21241060d6a |
| 423 |
user: test |
| 424 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 425 |
summary: hacked default |
| 426 |
|
| 427 |
|
| 428 |
$ rm -r ua atbranch |
| 429 |
|
| 430 |
|
| 431 |
Testing #<branch>: |
| 432 |
|
| 433 |
$ hg clone -u . a#stable ua |
| 434 |
adding changesets |
| 435 |
adding manifests |
| 436 |
adding file changes |
| 437 |
added 14 changesets with 14 changes to 3 files |
| 438 |
new changesets acb14030fe0a:0aae7cf88f0d |
| 439 |
updating to branch stable |
| 440 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 441 |
|
| 442 |
Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6): |
| 443 |
|
| 444 |
$ hg -R ua heads |
| 445 |
changeset: 13:0aae7cf88f0d |
| 446 |
branch: stable |
| 447 |
tag: tip |
| 448 |
user: test |
| 449 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 450 |
summary: another change for branch stable |
| 451 |
|
| 452 |
changeset: 10:a7949464abda |
| 453 |
user: test |
| 454 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 455 |
summary: test |
| 456 |
|
| 457 |
|
| 458 |
Same revision checked out in repo a and ua: |
| 459 |
|
| 460 |
$ hg -R a parents --template "{node|short}\n" |
| 461 |
e8ece76546a6 |
| 462 |
$ hg -R ua parents --template "{node|short}\n" |
| 463 |
e8ece76546a6 |
| 464 |
|
| 465 |
$ rm -r ua |
| 466 |
|
| 467 |
|
| 468 |
Testing -u -r <branch>: |
| 469 |
|
| 470 |
$ hg clone -u . -r stable a ua |
| 471 |
adding changesets |
| 472 |
adding manifests |
| 473 |
adding file changes |
| 474 |
added 14 changesets with 14 changes to 3 files |
| 475 |
new changesets acb14030fe0a:0aae7cf88f0d |
| 476 |
updating to branch stable |
| 477 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 478 |
|
| 479 |
Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6): |
| 480 |
|
| 481 |
$ hg -R ua heads |
| 482 |
changeset: 13:0aae7cf88f0d |
| 483 |
branch: stable |
| 484 |
tag: tip |
| 485 |
user: test |
| 486 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 487 |
summary: another change for branch stable |
| 488 |
|
| 489 |
changeset: 10:a7949464abda |
| 490 |
user: test |
| 491 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 492 |
summary: test |
| 493 |
|
| 494 |
|
| 495 |
Same revision checked out in repo a and ua: |
| 496 |
|
| 497 |
$ hg -R a parents --template "{node|short}\n" |
| 498 |
e8ece76546a6 |
| 499 |
$ hg -R ua parents --template "{node|short}\n" |
| 500 |
e8ece76546a6 |
| 501 |
|
| 502 |
$ rm -r ua |
| 503 |
|
| 504 |
|
| 505 |
Testing -r <branch>: |
| 506 |
|
| 507 |
$ hg clone -r stable a ua |
| 508 |
adding changesets |
| 509 |
adding manifests |
| 510 |
adding file changes |
| 511 |
added 14 changesets with 14 changes to 3 files |
| 512 |
new changesets acb14030fe0a:0aae7cf88f0d |
| 513 |
updating to branch stable |
| 514 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 515 |
|
| 516 |
Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6): |
| 517 |
|
| 518 |
$ hg -R ua heads |
| 519 |
changeset: 13:0aae7cf88f0d |
| 520 |
branch: stable |
| 521 |
tag: tip |
| 522 |
user: test |
| 523 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 524 |
summary: another change for branch stable |
| 525 |
|
| 526 |
changeset: 10:a7949464abda |
| 527 |
user: test |
| 528 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 529 |
summary: test |
| 530 |
|
| 531 |
|
| 532 |
Branch 'stable' is checked out: |
| 533 |
|
| 534 |
$ hg -R ua parents |
| 535 |
changeset: 13:0aae7cf88f0d |
| 536 |
branch: stable |
| 537 |
tag: tip |
| 538 |
user: test |
| 539 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 540 |
summary: another change for branch stable |
| 541 |
|
| 542 |
|
| 543 |
$ rm -r ua |
| 544 |
|
| 545 |
|
| 546 |
Issue2267: Error in 1.6 hg.py: TypeError: 'NoneType' object is not |
| 547 |
iterable in addbranchrevs() |
| 548 |
|
| 549 |
$ cat <<EOF > simpleclone.py |
| 550 |
> from mercurial import ui as uimod |
| 551 |
> from mercurial.cmd_impls import clone |
| 552 |
> from mercurial.repo import factory |
| 553 |
> myui = uimod.ui.load() |
| 554 |
> repo = factory.repository(myui, b'a') |
| 555 |
> clone.clone(myui, {}, repo, dest=b"ua") |
| 556 |
> EOF |
| 557 |
|
| 558 |
$ "$PYTHON" simpleclone.py |
| 559 |
updating to branch default |
| 560 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 561 |
|
| 562 |
$ rm -r ua |
| 563 |
|
| 564 |
$ cat <<EOF > branchclone.py |
| 565 |
> from mercurial import initialization |
| 566 |
> initialization.init() |
| 567 |
> from mercurial import extensions, ui as uimod |
| 568 |
> from mercurial.cmd_impls import clone |
| 569 |
> from mercurial.repo import factory |
| 570 |
> myui = uimod.ui.load() |
| 571 |
> extensions.loadall(myui) |
| 572 |
> extensions.populateui(myui) |
| 573 |
> repo = factory.repository(myui, b'a') |
| 574 |
> clone.clone(myui, {}, repo, dest=b"ua", branch=[b"stable"]) |
| 575 |
> EOF |
| 576 |
|
| 577 |
$ "$PYTHON" branchclone.py |
| 578 |
adding changesets |
| 579 |
adding manifests |
| 580 |
adding file changes |
| 581 |
added 14 changesets with 14 changes to 3 files |
| 582 |
new changesets acb14030fe0a:0aae7cf88f0d |
| 583 |
updating to branch stable |
| 584 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 585 |
$ rm -r ua |
| 586 |
|
| 587 |
Local clones don't get confused by unusual experimental.evolution options |
| 588 |
|
| 589 |
$ hg clone \ |
| 590 |
> --config experimental.evolution=allowunstable,allowdivergence,exchange \ |
| 591 |
> a ua |
| 592 |
updating to branch default |
| 593 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 594 |
$ rm -r ua |
| 595 |
|
| 596 |
$ hg clone \ |
| 597 |
> --config experimental.evolution.createmarkers=no \ |
| 598 |
> --config experimental.evolution.allowunstable=yes \ |
| 599 |
> --config experimental.evolution.allowdivergence=yes \ |
| 600 |
> --config experimental.evolution.exchange=yes \ |
| 601 |
> a ua |
| 602 |
updating to branch default |
| 603 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 604 |
$ rm -r ua |
| 605 |
|
| 606 |
Test clone with special '@' bookmark: |
| 607 |
$ cd a |
| 608 |
$ hg bookmark -r a7949464abda @ # branch point of stable from default |
| 609 |
$ hg clone . ../i |
| 610 |
updating to bookmark @ |
| 611 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 612 |
$ hg id -i ../i |
| 613 |
a7949464abda |
| 614 |
$ rm -r ../i |
| 615 |
|
| 616 |
$ hg bookmark -f -r stable @ |
| 617 |
$ hg bookmarks |
| 618 |
@ 15:0aae7cf88f0d |
| 619 |
$ hg clone . ../i |
| 620 |
updating to bookmark @ on branch stable |
| 621 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 622 |
$ hg id -i ../i |
| 623 |
0aae7cf88f0d |
| 624 |
$ cd "$TESTTMP" |
| 625 |
|
| 626 |
|
| 627 |
Testing failures: |
| 628 |
|
| 629 |
$ mkdir fail |
| 630 |
$ cd fail |
| 631 |
|
| 632 |
No local source |
| 633 |
|
| 634 |
$ hg clone a b |
| 635 |
abort: repository a not found |
| 636 |
[255] |
| 637 |
|
| 638 |
Invalid URL |
| 639 |
|
| 640 |
$ hg clone http://invalid:url/a b |
| 641 |
abort: error: nonnumeric port: 'url' |
| 642 |
[100] |
| 643 |
|
| 644 |
No remote source |
| 645 |
|
| 646 |
$ hg clone http://$LOCALIP:3121/a b |
| 647 |
abort: error: $ECONNREFUSED$ |
| 648 |
[100] |
| 649 |
|
| 650 |
$ rm -rf b # work around bug with http clone |
| 651 |
|
| 652 |
|
| 653 |
#if unix-permissions no-root |
| 654 |
|
| 655 |
Inaccessible source |
| 656 |
|
| 657 |
$ mkdir a |
| 658 |
$ chmod 000 a |
| 659 |
$ hg clone a b |
| 660 |
abort: $EACCES$: *$TESTTMP/fail/a/.hg* (glob) |
| 661 |
[255] |
| 662 |
|
| 663 |
Inaccessible destination |
| 664 |
|
| 665 |
$ hg init b |
| 666 |
$ cd b |
| 667 |
$ hg clone . ../a |
| 668 |
abort: $EACCES$: *../a* (glob) |
| 669 |
[255] |
| 670 |
$ cd .. |
| 671 |
$ chmod 700 a |
| 672 |
$ rm -r a b |
| 673 |
|
| 674 |
#endif |
| 675 |
|
| 676 |
|
| 677 |
#if fifo |
| 678 |
|
| 679 |
Source of wrong type |
| 680 |
|
| 681 |
$ mkfifo a |
| 682 |
$ hg clone a b |
| 683 |
abort: $ENOTDIR$: *$TESTTMP/fail/a/.hg* (glob) |
| 684 |
[255] |
| 685 |
$ rm a |
| 686 |
|
| 687 |
#endif |
| 688 |
|
| 689 |
Default destination, same directory |
| 690 |
|
| 691 |
$ hg init q |
| 692 |
$ hg clone q |
| 693 |
destination directory: q |
| 694 |
abort: destination 'q' is not empty |
| 695 |
[10] |
| 696 |
|
| 697 |
destination directory not empty |
| 698 |
|
| 699 |
$ mkdir a |
| 700 |
$ echo stuff > a/a |
| 701 |
$ hg clone q a |
| 702 |
abort: destination 'a' is not empty |
| 703 |
[10] |
| 704 |
|
| 705 |
|
| 706 |
#if unix-permissions no-root |
| 707 |
|
| 708 |
leave existing directory in place after clone failure |
| 709 |
|
| 710 |
$ hg init c |
| 711 |
$ cd c |
| 712 |
$ echo c > c |
| 713 |
$ hg commit -A -m test |
| 714 |
adding c |
| 715 |
$ chmod -rx .hg/store/data |
| 716 |
$ cd .. |
| 717 |
$ mkdir d |
| 718 |
$ hg clone c d 2> err |
| 719 |
[255] |
| 720 |
$ test -d d |
| 721 |
$ test -d d/.hg |
| 722 |
[1] |
| 723 |
|
| 724 |
re-enable perm to allow deletion |
| 725 |
|
| 726 |
$ chmod +rx c/.hg/store/data |
| 727 |
|
| 728 |
#endif |
| 729 |
|
| 730 |
$ cd .. |
| 731 |
|
| 732 |
Test clone from the repository in (emulated) revlog format 0 (issue4203): |
| 733 |
|
| 734 |
$ mkdir issue4203 |
| 735 |
$ mkdir -p src/.hg |
| 736 |
$ echo foo > src/foo |
| 737 |
$ hg -R src add src/foo |
| 738 |
$ hg -R src commit -m '#0' |
| 739 |
$ hg -R src log -q |
| 740 |
0:e1bab28bca43 |
| 741 |
$ hg -R src debugrevlog -c | grep -E 'format|flags' |
| 742 |
format : 0 |
| 743 |
flags : (none) |
| 744 |
$ hg root -R src -T json | sed 's|\\\\|\\|g' |
| 745 |
[ |
| 746 |
{ |
| 747 |
"hgpath": "$TESTTMP/src/.hg", |
| 748 |
"reporoot": "$TESTTMP/src", |
| 749 |
"storepath": "$TESTTMP/src/.hg" |
| 750 |
} |
| 751 |
] |
| 752 |
$ hg clone -U -q src dst |
| 753 |
$ hg -R dst log -q |
| 754 |
0:e1bab28bca43 |
| 755 |
|
| 756 |
Create repositories to test auto sharing functionality |
| 757 |
|
| 758 |
$ cat >> $HGRCPATH << EOF |
| 759 |
> [extensions] |
| 760 |
> share= |
| 761 |
> EOF |
| 762 |
|
| 763 |
$ hg init empty |
| 764 |
$ hg init source1a |
| 765 |
$ cd source1a |
| 766 |
$ echo initial1 > foo |
| 767 |
$ hg -q commit -A -m initial |
| 768 |
$ echo second > foo |
| 769 |
$ hg commit -m second |
| 770 |
$ cd .. |
| 771 |
|
| 772 |
$ hg init filteredrev0 |
| 773 |
$ cd filteredrev0 |
| 774 |
$ cat >> .hg/hgrc << EOF |
| 775 |
> [experimental] |
| 776 |
> evolution.createmarkers=True |
| 777 |
> EOF |
| 778 |
$ echo initial1 > foo |
| 779 |
$ hg -q commit -A -m initial0 |
| 780 |
$ hg -q up -r null |
| 781 |
$ echo initial2 > foo |
| 782 |
$ hg -q commit -A -m initial1 |
| 783 |
$ hg debugobsolete c05d5c47a5cf81401869999f3d05f7d699d2b29a e082c1832e09a7d1e78b7fd49a592d372de854c8 |
| 784 |
1 new obsolescence markers |
| 785 |
obsoleted 1 changesets |
| 786 |
$ cd .. |
| 787 |
|
| 788 |
$ hg -q clone --pull source1a source1b |
| 789 |
$ cd source1a |
| 790 |
$ hg bookmark bookA |
| 791 |
$ echo 1a > foo |
| 792 |
$ hg commit -m 1a |
| 793 |
$ cd ../source1b |
| 794 |
$ hg -q up -r 0 |
| 795 |
$ echo head1 > foo |
| 796 |
$ hg commit -m head1 |
| 797 |
created new head |
| 798 |
$ hg bookmark head1 |
| 799 |
$ hg -q up -r 0 |
| 800 |
$ echo head2 > foo |
| 801 |
$ hg commit -m head2 |
| 802 |
created new head |
| 803 |
$ hg bookmark head2 |
| 804 |
$ hg -q up -r 0 |
| 805 |
$ hg branch branch1 |
| 806 |
marked working directory as branch branch1 |
| 807 |
(branches are permanent and global, did you want a bookmark?) |
| 808 |
$ echo branch1 > foo |
| 809 |
$ hg commit -m branch1 |
| 810 |
$ hg -q up -r 0 |
| 811 |
$ hg branch branch2 |
| 812 |
marked working directory as branch branch2 |
| 813 |
$ echo branch2 > foo |
| 814 |
$ hg commit -m branch2 |
| 815 |
$ cd .. |
| 816 |
$ hg init source2 |
| 817 |
$ cd source2 |
| 818 |
$ echo initial2 > foo |
| 819 |
$ hg -q commit -A -m initial2 |
| 820 |
$ echo second > foo |
| 821 |
$ hg commit -m second |
| 822 |
$ cd .. |
| 823 |
|
| 824 |
Clone with auto share from an empty repo should not result in share |
| 825 |
|
| 826 |
$ mkdir share |
| 827 |
$ hg --config share.pool=share clone empty share-empty |
| 828 |
(not using pooled storage: remote appears to be empty) |
| 829 |
updating to branch default |
| 830 |
0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 831 |
$ ls share |
| 832 |
$ test -d share-empty/.hg/store |
| 833 |
$ test -f share-empty/.hg/sharedpath |
| 834 |
[1] |
| 835 |
|
| 836 |
Clone with auto share from a repo with filtered revision 0 should not result in share |
| 837 |
|
| 838 |
$ hg --config share.pool=share clone filteredrev0 share-filtered |
| 839 |
(not using pooled storage: unable to resolve identity of remote) |
| 840 |
requesting all changes |
| 841 |
adding changesets |
| 842 |
adding manifests |
| 843 |
adding file changes |
| 844 |
added 1 changesets with 1 changes to 1 files |
| 845 |
new changesets e082c1832e09 |
| 846 |
updating to branch default |
| 847 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 848 |
|
| 849 |
Clone from repo with content should result in shared store being created |
| 850 |
|
| 851 |
$ hg --config share.pool=share clone source1a share-dest1a |
| 852 |
(sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1) |
| 853 |
requesting all changes |
| 854 |
adding changesets |
| 855 |
adding manifests |
| 856 |
adding file changes |
| 857 |
added 3 changesets with 3 changes to 1 files |
| 858 |
new changesets b5f04eac9d8f:e5bfe23c0b47 |
| 859 |
searching for changes |
| 860 |
no changes found |
| 861 |
adding remote bookmark bookA |
| 862 |
updating working directory |
| 863 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 864 |
|
| 865 |
The shared repo should have been created |
| 866 |
|
| 867 |
$ ls share |
| 868 |
b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1 |
| 869 |
|
| 870 |
The destination should point to it |
| 871 |
|
| 872 |
$ cat share-dest1a/.hg/sharedpath; echo |
| 873 |
$TESTTMP/share/b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1/.hg |
| 874 |
|
| 875 |
The destination should have bookmarks |
| 876 |
|
| 877 |
$ hg -R share-dest1a bookmarks |
| 878 |
bookA 2:e5bfe23c0b47 |
| 879 |
|
| 880 |
The default path should be the remote, not the share |
| 881 |
|
| 882 |
$ hg -R share-dest1a config paths.default |
| 883 |
$TESTTMP/source1a |
| 884 |
|
| 885 |
Clone with existing share dir should result in pull + share |
| 886 |
|
| 887 |
$ hg --config share.pool=share clone source1b share-dest1b |
| 888 |
(sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1) |
| 889 |
searching for changes |
| 890 |
adding changesets |
| 891 |
adding manifests |
| 892 |
adding file changes |
| 893 |
adding remote bookmark head1 |
| 894 |
adding remote bookmark head2 |
| 895 |
added 4 changesets with 4 changes to 1 files (+4 heads) |
| 896 |
new changesets 4a8dc1ab4c13:6bacf4683960 |
| 897 |
updating working directory |
| 898 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 899 |
|
| 900 |
$ ls share |
| 901 |
b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1 |
| 902 |
|
| 903 |
$ cat share-dest1b/.hg/sharedpath; echo |
| 904 |
$TESTTMP/share/b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1/.hg |
| 905 |
|
| 906 |
We only get bookmarks from the remote, not everything in the share |
| 907 |
|
| 908 |
$ hg -R share-dest1b bookmarks |
| 909 |
head1 3:4a8dc1ab4c13 |
| 910 |
head2 4:99f71071f117 |
| 911 |
|
| 912 |
Default path should be source, not share. |
| 913 |
|
| 914 |
$ hg -R share-dest1b config paths.default |
| 915 |
$TESTTMP/source1b |
| 916 |
|
| 917 |
Checked out revision should be head of default branch |
| 918 |
|
| 919 |
$ hg -R share-dest1b log -r . |
| 920 |
changeset: 4:99f71071f117 |
| 921 |
bookmark: head2 |
| 922 |
parent: 0:b5f04eac9d8f |
| 923 |
user: test |
| 924 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 925 |
summary: head2 |
| 926 |
|
| 927 |
|
| 928 |
Clone from unrelated repo should result in new share |
| 929 |
|
| 930 |
$ hg --config share.pool=share clone source2 share-dest2 |
| 931 |
(sharing from new pooled repository 22aeff664783fd44c6d9b435618173c118c3448e) |
| 932 |
requesting all changes |
| 933 |
adding changesets |
| 934 |
adding manifests |
| 935 |
adding file changes |
| 936 |
added 2 changesets with 2 changes to 1 files |
| 937 |
new changesets 22aeff664783:63cf6c3dba4a |
| 938 |
searching for changes |
| 939 |
no changes found |
| 940 |
updating working directory |
| 941 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 942 |
|
| 943 |
$ ls share |
| 944 |
22aeff664783fd44c6d9b435618173c118c3448e |
| 945 |
b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1 |
| 946 |
|
| 947 |
remote naming mode works as advertised |
| 948 |
|
| 949 |
$ hg --config share.pool=shareremote --config share.poolnaming=remote clone source1a share-remote1a |
| 950 |
(sharing from new pooled repository 195bb1fcdb595c14a6c13e0269129ed78f6debde) |
| 951 |
requesting all changes |
| 952 |
adding changesets |
| 953 |
adding manifests |
| 954 |
adding file changes |
| 955 |
added 3 changesets with 3 changes to 1 files |
| 956 |
new changesets b5f04eac9d8f:e5bfe23c0b47 |
| 957 |
searching for changes |
| 958 |
no changes found |
| 959 |
adding remote bookmark bookA |
| 960 |
updating working directory |
| 961 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 962 |
|
| 963 |
$ ls shareremote |
| 964 |
195bb1fcdb595c14a6c13e0269129ed78f6debde |
| 965 |
|
| 966 |
$ hg --config share.pool=shareremote --config share.poolnaming=remote clone source1b share-remote1b |
| 967 |
(sharing from new pooled repository c0d4f83847ca2a873741feb7048a45085fd47c46) |
| 968 |
requesting all changes |
| 969 |
adding changesets |
| 970 |
adding manifests |
| 971 |
adding file changes |
| 972 |
added 6 changesets with 6 changes to 1 files (+4 heads) |
| 973 |
new changesets b5f04eac9d8f:6bacf4683960 |
| 974 |
searching for changes |
| 975 |
no changes found |
| 976 |
adding remote bookmark head1 |
| 977 |
adding remote bookmark head2 |
| 978 |
updating working directory |
| 979 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 980 |
|
| 981 |
$ ls shareremote |
| 982 |
195bb1fcdb595c14a6c13e0269129ed78f6debde |
| 983 |
c0d4f83847ca2a873741feb7048a45085fd47c46 |
| 984 |
|
| 985 |
request to clone a single revision is respected in sharing mode |
| 986 |
|
| 987 |
$ hg --config share.pool=sharerevs clone -r 4a8dc1ab4c13 source1b share-1arev |
| 988 |
(sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1) |
| 989 |
adding changesets |
| 990 |
adding manifests |
| 991 |
adding file changes |
| 992 |
added 2 changesets with 2 changes to 1 files |
| 993 |
new changesets b5f04eac9d8f:4a8dc1ab4c13 |
| 994 |
no changes found |
| 995 |
adding remote bookmark head1 |
| 996 |
updating working directory |
| 997 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 998 |
|
| 999 |
$ hg -R share-1arev log -G |
| 1000 |
@ changeset: 1:4a8dc1ab4c13 |
| 1001 |
| bookmark: head1 |
| 1002 |
| tag: tip |
| 1003 |
| user: test |
| 1004 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 1005 |
| summary: head1 |
| 1006 |
| |
| 1007 |
o changeset: 0:b5f04eac9d8f |
| 1008 |
user: test |
| 1009 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 1010 |
summary: initial |
| 1011 |
|
| 1012 |
|
| 1013 |
making another clone should only pull down requested rev |
| 1014 |
|
| 1015 |
$ hg --config share.pool=sharerevs clone -r 99f71071f117 source1b share-1brev |
| 1016 |
(sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1) |
| 1017 |
searching for changes |
| 1018 |
adding changesets |
| 1019 |
adding manifests |
| 1020 |
adding file changes |
| 1021 |
adding remote bookmark head1 |
| 1022 |
adding remote bookmark head2 |
| 1023 |
added 1 changesets with 1 changes to 1 files (+1 heads) |
| 1024 |
new changesets 99f71071f117 |
| 1025 |
updating working directory |
| 1026 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 1027 |
|
| 1028 |
$ hg -R share-1brev log -G |
| 1029 |
@ changeset: 2:99f71071f117 |
| 1030 |
| bookmark: head2 |
| 1031 |
| tag: tip |
| 1032 |
| parent: 0:b5f04eac9d8f |
| 1033 |
| user: test |
| 1034 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 1035 |
| summary: head2 |
| 1036 |
| |
| 1037 |
| o changeset: 1:4a8dc1ab4c13 |
| 1038 |
|/ bookmark: head1 |
| 1039 |
| user: test |
| 1040 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 1041 |
| summary: head1 |
| 1042 |
| |
| 1043 |
o changeset: 0:b5f04eac9d8f |
| 1044 |
user: test |
| 1045 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 1046 |
summary: initial |
| 1047 |
|
| 1048 |
|
| 1049 |
Request to clone a single branch is respected in sharing mode |
| 1050 |
|
| 1051 |
$ hg --config share.pool=sharebranch clone -b branch1 source1b share-1bbranch1 |
| 1052 |
(sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1) |
| 1053 |
adding changesets |
| 1054 |
adding manifests |
| 1055 |
adding file changes |
| 1056 |
added 2 changesets with 2 changes to 1 files |
| 1057 |
new changesets b5f04eac9d8f:5f92a6c1a1b1 |
| 1058 |
no changes found |
| 1059 |
updating working directory |
| 1060 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 1061 |
|
| 1062 |
$ hg -R share-1bbranch1 log -G |
| 1063 |
o changeset: 1:5f92a6c1a1b1 |
| 1064 |
| branch: branch1 |
| 1065 |
| tag: tip |
| 1066 |
| user: test |
| 1067 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 1068 |
| summary: branch1 |
| 1069 |
| |
| 1070 |
@ changeset: 0:b5f04eac9d8f |
| 1071 |
user: test |
| 1072 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 1073 |
summary: initial |
| 1074 |
|
| 1075 |
|
| 1076 |
$ hg --config share.pool=sharebranch clone -b branch2 source1b share-1bbranch2 |
| 1077 |
(sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1) |
| 1078 |
searching for changes |
| 1079 |
adding changesets |
| 1080 |
adding manifests |
| 1081 |
adding file changes |
| 1082 |
added 1 changesets with 1 changes to 1 files (+1 heads) |
| 1083 |
new changesets 6bacf4683960 |
| 1084 |
updating working directory |
| 1085 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 1086 |
|
| 1087 |
$ hg -R share-1bbranch2 log -G |
| 1088 |
o changeset: 2:6bacf4683960 |
| 1089 |
| branch: branch2 |
| 1090 |
| tag: tip |
| 1091 |
| parent: 0:b5f04eac9d8f |
| 1092 |
| user: test |
| 1093 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 1094 |
| summary: branch2 |
| 1095 |
| |
| 1096 |
| o changeset: 1:5f92a6c1a1b1 |
| 1097 |
|/ branch: branch1 |
| 1098 |
| user: test |
| 1099 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 1100 |
| summary: branch1 |
| 1101 |
| |
| 1102 |
@ changeset: 0:b5f04eac9d8f |
| 1103 |
user: test |
| 1104 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 1105 |
summary: initial |
| 1106 |
|
| 1107 |
|
| 1108 |
-U is respected in share clone mode |
| 1109 |
|
| 1110 |
$ hg --config share.pool=share clone -U source1a share-1anowc |
| 1111 |
(sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1) |
| 1112 |
searching for changes |
| 1113 |
no changes found |
| 1114 |
adding remote bookmark bookA |
| 1115 |
|
| 1116 |
$ ls -A share-1anowc |
| 1117 |
.hg |
| 1118 |
|
| 1119 |
Test that auto sharing doesn't cause failure of "hg clone local remote" |
| 1120 |
|
| 1121 |
$ cd $TESTTMP |
| 1122 |
$ hg -R a id -r 0 |
| 1123 |
acb14030fe0a |
| 1124 |
$ hg id -R remote -r 0 |
| 1125 |
abort: repository remote not found |
| 1126 |
[255] |
| 1127 |
$ hg --config share.pool=share -q clone a ssh://user@dummy/remote |
| 1128 |
$ hg -R remote id -r 0 |
| 1129 |
acb14030fe0a |
| 1130 |
|
| 1131 |
Cloning into pooled storage doesn't race (issue5104) |
| 1132 |
|
| 1133 |
$ HGPOSTLOCKDELAY=2.0 hg --config share.pool=racepool --config extensions.lockdelay=$TESTDIR/lockdelay.py clone source1a share-destrace1 > race1.log 2>&1 & |
| 1134 |
$ HGPRELOCKDELAY=1.0 hg --config share.pool=racepool --config extensions.lockdelay=$TESTDIR/lockdelay.py clone source1a share-destrace2 > race2.log 2>&1 |
| 1135 |
$ wait |
| 1136 |
|
| 1137 |
$ hg -R share-destrace1 log -r tip |
| 1138 |
changeset: 2:e5bfe23c0b47 |
| 1139 |
bookmark: bookA |
| 1140 |
tag: tip |
| 1141 |
user: test |
| 1142 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 1143 |
summary: 1a |
| 1144 |
|
| 1145 |
|
| 1146 |
$ hg -R share-destrace2 log -r tip |
| 1147 |
changeset: 2:e5bfe23c0b47 |
| 1148 |
bookmark: bookA |
| 1149 |
tag: tip |
| 1150 |
user: test |
| 1151 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 1152 |
summary: 1a |
| 1153 |
|
| 1154 |
One repo should be new, the other should be shared from the pool. We |
| 1155 |
don't care which is which, so we just make sure we always print the |
| 1156 |
one containing "new pooled" first, then one one containing "existing |
| 1157 |
pooled". |
| 1158 |
|
| 1159 |
$ (grep 'new pooled' race1.log > /dev/null && cat race1.log || cat race2.log) | grep -v lock |
| 1160 |
(sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1) |
| 1161 |
requesting all changes |
| 1162 |
adding changesets |
| 1163 |
adding manifests |
| 1164 |
adding file changes |
| 1165 |
added 3 changesets with 3 changes to 1 files |
| 1166 |
new changesets b5f04eac9d8f:e5bfe23c0b47 |
| 1167 |
searching for changes |
| 1168 |
no changes found |
| 1169 |
adding remote bookmark bookA |
| 1170 |
updating working directory |
| 1171 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 1172 |
|
| 1173 |
$ (grep 'existing pooled' race1.log > /dev/null && cat race1.log || cat race2.log) | grep -v lock |
| 1174 |
(sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1) |
| 1175 |
searching for changes |
| 1176 |
no changes found |
| 1177 |
adding remote bookmark bookA |
| 1178 |
updating working directory |
| 1179 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 1180 |
|
| 1181 |
SEC: check for unsafe ssh url |
| 1182 |
|
| 1183 |
$ cat >> $HGRCPATH << EOF |
| 1184 |
> [ui] |
| 1185 |
> ssh = sh -c "read l; read l; read l" |
| 1186 |
> EOF |
| 1187 |
|
| 1188 |
$ hg clone 'ssh://-oProxyCommand=touch${IFS}owned/path' |
| 1189 |
abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path' |
| 1190 |
[255] |
| 1191 |
$ hg clone 'ssh://%2DoProxyCommand=touch${IFS}owned/path' |
| 1192 |
abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path' |
| 1193 |
[255] |
| 1194 |
$ hg clone 'ssh://fakehost|touch%20owned/path' |
| 1195 |
abort: no suitable response from remote hg |
| 1196 |
[255] |
| 1197 |
$ hg clone 'ssh://fakehost%7Ctouch%20owned/path' |
| 1198 |
abort: no suitable response from remote hg |
| 1199 |
[255] |
| 1200 |
|
| 1201 |
$ hg clone 'ssh://-oProxyCommand=touch owned%[email protected]/nonexistent/path' |
| 1202 |
abort: potentially unsafe url: 'ssh://-oProxyCommand=touch owned [email protected]/nonexistent/path' |
| 1203 |
[255] |
| 1204 |
|
| 1205 |
#if windows |
| 1206 |
$ hg clone "ssh://%26touch%20owned%20/" --debug |
| 1207 |
running sh -c "read l; read l; read l" "&touch owned " "hg -R . serve --stdio" |
| 1208 |
sending hello command |
| 1209 |
sending between command |
| 1210 |
abort: no suitable response from remote hg |
| 1211 |
[255] |
| 1212 |
$ hg clone "ssh://example.com:%26touch%20owned%20/" --debug |
| 1213 |
running sh -c "read l; read l; read l" -p "&touch owned " example.com "hg -R . serve --stdio" |
| 1214 |
sending hello command |
| 1215 |
sending between command |
| 1216 |
abort: no suitable response from remote hg |
| 1217 |
[255] |
| 1218 |
#else |
| 1219 |
$ hg clone "ssh://%3btouch%20owned%20/" --debug |
| 1220 |
running sh -c "read l; read l; read l" ';touch owned ' 'hg -R . serve --stdio' |
| 1221 |
sending hello command |
| 1222 |
sending between command |
| 1223 |
abort: no suitable response from remote hg |
| 1224 |
[255] |
| 1225 |
$ hg clone "ssh://example.com:%3btouch%20owned%20/" --debug |
| 1226 |
running sh -c "read l; read l; read l" -p ';touch owned ' example.com 'hg -R . serve --stdio' |
| 1227 |
sending hello command |
| 1228 |
sending between command |
| 1229 |
abort: no suitable response from remote hg |
| 1230 |
[255] |
| 1231 |
#endif |
| 1232 |
|
| 1233 |
$ hg clone "ssh://v-alid.example.com/" --debug |
| 1234 |
running sh -c "read l; read l; read l" v-alid\.example\.com ['"]hg -R \. serve --stdio['"] (re) |
| 1235 |
sending hello command |
| 1236 |
sending between command |
| 1237 |
abort: no suitable response from remote hg |
| 1238 |
[255] |
| 1239 |
|
| 1240 |
We should not have created a file named owned - if it exists, the |
| 1241 |
attack succeeded. |
| 1242 |
$ if test -f owned; then echo 'you got owned'; fi |
| 1243 |
|
| 1244 |
Cloning without fsmonitor enabled does not print a warning for small repos |
| 1245 |
|
| 1246 |
$ hg clone a fsmonitor-default |
| 1247 |
updating to bookmark @ on branch stable |
| 1248 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 1249 |
|
| 1250 |
Lower the warning threshold to simulate a large repo |
| 1251 |
|
| 1252 |
$ cat >> $HGRCPATH << EOF |
| 1253 |
> [fsmonitor] |
| 1254 |
> warn_update_file_count = 2 |
| 1255 |
> warn_update_file_count_rust = 2 |
| 1256 |
> EOF |
| 1257 |
|
| 1258 |
We should see a warning about no fsmonitor on supported platforms |
| 1259 |
|
| 1260 |
#if linuxormacos no-fsmonitor |
| 1261 |
$ hg clone a nofsmonitor |
| 1262 |
updating to bookmark @ on branch stable |
| 1263 |
(warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor") (no-rust !) |
| 1264 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 1265 |
#else |
| 1266 |
$ hg clone a nofsmonitor |
| 1267 |
updating to bookmark @ on branch stable |
| 1268 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 1269 |
#endif |
| 1270 |
|
| 1271 |
We should not see warning about fsmonitor when it is enabled |
| 1272 |
|
| 1273 |
#if fsmonitor |
| 1274 |
$ hg clone a fsmonitor-enabled |
| 1275 |
updating to bookmark @ on branch stable |
| 1276 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 1277 |
#endif |
| 1278 |
|
| 1279 |
We can disable the fsmonitor warning |
| 1280 |
|
| 1281 |
$ hg --config fsmonitor.warn_when_unused=false clone a fsmonitor-disable-warning |
| 1282 |
updating to bookmark @ on branch stable |
| 1283 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 1284 |
|
| 1285 |
Loaded fsmonitor but disabled in config should still print warning |
| 1286 |
|
| 1287 |
#if linuxormacos fsmonitor |
| 1288 |
$ hg --config fsmonitor.mode=off clone a fsmonitor-mode-off |
| 1289 |
updating to bookmark @ on branch stable |
| 1290 |
(warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor") (fsmonitor !) |
| 1291 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 1292 |
#endif |
| 1293 |
|
| 1294 |
Warning not printed if working directory isn't empty |
| 1295 |
|
| 1296 |
$ hg -q clone a fsmonitor-update |
| 1297 |
(warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor") (?) |
| 1298 |
$ cd fsmonitor-update |
| 1299 |
$ hg up acb14030fe0a |
| 1300 |
1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
| 1301 |
(leaving bookmark @) |
| 1302 |
$ hg up cf0fe1914066 |
| 1303 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 1304 |
|
| 1305 |
`hg update` from null revision also prints |
| 1306 |
|
| 1307 |
$ hg up null |
| 1308 |
0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
| 1309 |
|
| 1310 |
#if linuxormacos no-fsmonitor |
| 1311 |
$ hg up cf0fe1914066 |
| 1312 |
(warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor") (no-rust !) |
| 1313 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 1314 |
#else |
| 1315 |
$ hg up cf0fe1914066 |
| 1316 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 1317 |
#endif |
| 1318 |
|
| 1319 |
$ cd .. |
| 1320 |
|