##// END OF EJS Templates
tests: mark manifestfulltextcache as conditional on revlog store...
Gregory Szorc -
r39359:c11e8894 default
parent child Browse files
Show More
@@ -1,1296 +1,1296 b''
1 1 #testcases sshv1 sshv2
2 2
3 3 #if sshv2
4 4 $ cat >> $HGRCPATH << EOF
5 5 > [experimental]
6 6 > sshpeer.advertise-v2 = true
7 7 > sshserver.support-v2 = true
8 8 > EOF
9 9 #endif
10 10
11 11 Prepare repo a:
12 12
13 13 $ hg init a
14 14 $ cd a
15 15 $ echo a > a
16 16 $ hg add a
17 17 $ hg commit -m test
18 18 $ echo first line > b
19 19 $ hg add b
20 20
21 21 Create a non-inlined filelog:
22 22
23 23 $ $PYTHON -c 'open("data1", "wb").write(b"".join(b"%d\n" % x for x in range(10000)))'
24 24 $ for j in 0 1 2 3 4 5 6 7 8 9; do
25 25 > cat data1 >> b
26 26 > hg commit -m test
27 27 > done
28 28
29 29 List files in store/data (should show a 'b.d'):
30 30
31 31 #if reporevlogstore
32 32 $ for i in .hg/store/data/*; do
33 33 > echo $i
34 34 > done
35 35 .hg/store/data/a.i
36 36 .hg/store/data/b.d
37 37 .hg/store/data/b.i
38 38 #endif
39 39
40 40 Trigger branchcache creation:
41 41
42 42 $ hg branches
43 43 default 10:a7949464abda
44 44 $ ls .hg/cache
45 45 branch2-served
46 46 checkisexec (execbit !)
47 47 checklink (symlink !)
48 48 checklink-target (symlink !)
49 49 checknoexec (execbit !)
50 manifestfulltextcache
50 manifestfulltextcache (reporevlogstore !)
51 51 rbc-names-v1
52 52 rbc-revs-v1
53 53
54 54 Default operation:
55 55
56 56 $ hg clone . ../b
57 57 updating to branch default
58 58 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
59 59 $ cd ../b
60 60
61 61 Ensure branchcache got copied over:
62 62
63 63 $ ls .hg/cache
64 64 branch2-served
65 65 checkisexec (execbit !)
66 66 checklink (symlink !)
67 67 checklink-target (symlink !)
68 68 rbc-names-v1
69 69 rbc-revs-v1
70 70
71 71 $ cat a
72 72 a
73 73 $ hg verify
74 74 checking changesets
75 75 checking manifests
76 76 crosschecking files in changesets and manifests
77 77 checking files
78 78 2 files, 11 changesets, 11 total revisions
79 79
80 80 Invalid dest '' must abort:
81 81
82 82 $ hg clone . ''
83 83 abort: empty destination path is not valid
84 84 [255]
85 85
86 86 No update, with debug option:
87 87
88 88 #if hardlink
89 89 $ hg --debug clone -U . ../c --config progress.debug=true
90 90 linking: 1
91 91 linking: 2
92 92 linking: 3
93 93 linking: 4
94 94 linking: 5
95 95 linking: 6
96 96 linking: 7
97 97 linking: 8
98 98 linked 8 files (reporevlogstore !)
99 99 linking: 9 (reposimplestore !)
100 100 linking: 10 (reposimplestore !)
101 101 linking: 11 (reposimplestore !)
102 102 linking: 12 (reposimplestore !)
103 103 linking: 13 (reposimplestore !)
104 104 linking: 14 (reposimplestore !)
105 105 linking: 15 (reposimplestore !)
106 106 linking: 16 (reposimplestore !)
107 107 linking: 17 (reposimplestore !)
108 108 linking: 18 (reposimplestore !)
109 109 linked 18 files (reposimplestore !)
110 110 #else
111 111 $ hg --debug clone -U . ../c --config progress.debug=true
112 112 linking: 1
113 113 copying: 2
114 114 copying: 3
115 115 copying: 4
116 116 copying: 5
117 117 copying: 6
118 118 copying: 7
119 119 copying: 8
120 120 copied 8 files (reporevlogstore !)
121 121 copying: 9 (reposimplestore !)
122 122 copying: 10 (reposimplestore !)
123 123 copying: 11 (reposimplestore !)
124 124 copying: 12 (reposimplestore !)
125 125 copying: 13 (reposimplestore !)
126 126 copying: 14 (reposimplestore !)
127 127 copying: 15 (reposimplestore !)
128 128 copying: 16 (reposimplestore !)
129 129 copying: 17 (reposimplestore !)
130 130 copying: 18 (reposimplestore !)
131 131 copied 18 files (reposimplestore !)
132 132 #endif
133 133 $ cd ../c
134 134
135 135 Ensure branchcache got copied over:
136 136
137 137 $ ls .hg/cache
138 138 branch2-served
139 139 rbc-names-v1
140 140 rbc-revs-v1
141 141
142 142 $ cat a 2>/dev/null || echo "a not present"
143 143 a not present
144 144 $ hg verify
145 145 checking changesets
146 146 checking manifests
147 147 crosschecking files in changesets and manifests
148 148 checking files
149 149 2 files, 11 changesets, 11 total revisions
150 150
151 151 Default destination:
152 152
153 153 $ mkdir ../d
154 154 $ cd ../d
155 155 $ hg clone ../a
156 156 destination directory: a
157 157 updating to branch default
158 158 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
159 159 $ cd a
160 160 $ hg cat a
161 161 a
162 162 $ cd ../..
163 163
164 164 Check that we drop the 'file:' from the path before writing the .hgrc:
165 165
166 166 $ hg clone file:a e
167 167 updating to branch default
168 168 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
169 169 $ grep 'file:' e/.hg/hgrc
170 170 [1]
171 171
172 172 Check that path aliases are expanded:
173 173
174 174 $ hg clone -q -U --config 'paths.foobar=a#0' foobar f
175 175 $ hg -R f showconfig paths.default
176 176 $TESTTMP/a#0
177 177
178 178 Use --pull:
179 179
180 180 $ hg clone --pull a g
181 181 requesting all changes
182 182 adding changesets
183 183 adding manifests
184 184 adding file changes
185 185 added 11 changesets with 11 changes to 2 files
186 186 new changesets acb14030fe0a:a7949464abda
187 187 updating to branch default
188 188 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
189 189 $ hg -R g verify
190 190 checking changesets
191 191 checking manifests
192 192 crosschecking files in changesets and manifests
193 193 checking files
194 194 2 files, 11 changesets, 11 total revisions
195 195
196 196 Invalid dest '' with --pull must abort (issue2528):
197 197
198 198 $ hg clone --pull a ''
199 199 abort: empty destination path is not valid
200 200 [255]
201 201
202 202 Clone to '.':
203 203
204 204 $ mkdir h
205 205 $ cd h
206 206 $ hg clone ../a .
207 207 updating to branch default
208 208 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
209 209 $ cd ..
210 210
211 211
212 212 *** Tests for option -u ***
213 213
214 214 Adding some more history to repo a:
215 215
216 216 $ cd a
217 217 $ hg tag ref1
218 218 $ echo the quick brown fox >a
219 219 $ hg ci -m "hacked default"
220 220 $ hg up ref1
221 221 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
222 222 $ hg branch stable
223 223 marked working directory as branch stable
224 224 (branches are permanent and global, did you want a bookmark?)
225 225 $ echo some text >a
226 226 $ hg ci -m "starting branch stable"
227 227 $ hg tag ref2
228 228 $ echo some more text >a
229 229 $ hg ci -m "another change for branch stable"
230 230 $ hg up ref2
231 231 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
232 232 $ hg parents
233 233 changeset: 13:e8ece76546a6
234 234 branch: stable
235 235 tag: ref2
236 236 parent: 10:a7949464abda
237 237 user: test
238 238 date: Thu Jan 01 00:00:00 1970 +0000
239 239 summary: starting branch stable
240 240
241 241
242 242 Repo a has two heads:
243 243
244 244 $ hg heads
245 245 changeset: 15:0aae7cf88f0d
246 246 branch: stable
247 247 tag: tip
248 248 user: test
249 249 date: Thu Jan 01 00:00:00 1970 +0000
250 250 summary: another change for branch stable
251 251
252 252 changeset: 12:f21241060d6a
253 253 user: test
254 254 date: Thu Jan 01 00:00:00 1970 +0000
255 255 summary: hacked default
256 256
257 257
258 258 $ cd ..
259 259
260 260
261 261 Testing --noupdate with --updaterev (must abort):
262 262
263 263 $ hg clone --noupdate --updaterev 1 a ua
264 264 abort: cannot specify both --noupdate and --updaterev
265 265 [255]
266 266
267 267
268 268 Testing clone -u:
269 269
270 270 $ hg clone -u . a ua
271 271 updating to branch stable
272 272 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
273 273
274 274 Repo ua has both heads:
275 275
276 276 $ hg -R ua heads
277 277 changeset: 15:0aae7cf88f0d
278 278 branch: stable
279 279 tag: tip
280 280 user: test
281 281 date: Thu Jan 01 00:00:00 1970 +0000
282 282 summary: another change for branch stable
283 283
284 284 changeset: 12:f21241060d6a
285 285 user: test
286 286 date: Thu Jan 01 00:00:00 1970 +0000
287 287 summary: hacked default
288 288
289 289
290 290 Same revision checked out in repo a and ua:
291 291
292 292 $ hg -R a parents --template "{node|short}\n"
293 293 e8ece76546a6
294 294 $ hg -R ua parents --template "{node|short}\n"
295 295 e8ece76546a6
296 296
297 297 $ rm -r ua
298 298
299 299
300 300 Testing clone --pull -u:
301 301
302 302 $ hg clone --pull -u . a ua
303 303 requesting all changes
304 304 adding changesets
305 305 adding manifests
306 306 adding file changes
307 307 added 16 changesets with 16 changes to 3 files (+1 heads)
308 308 new changesets acb14030fe0a:0aae7cf88f0d
309 309 updating to branch stable
310 310 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
311 311
312 312 Repo ua has both heads:
313 313
314 314 $ hg -R ua heads
315 315 changeset: 15:0aae7cf88f0d
316 316 branch: stable
317 317 tag: tip
318 318 user: test
319 319 date: Thu Jan 01 00:00:00 1970 +0000
320 320 summary: another change for branch stable
321 321
322 322 changeset: 12:f21241060d6a
323 323 user: test
324 324 date: Thu Jan 01 00:00:00 1970 +0000
325 325 summary: hacked default
326 326
327 327
328 328 Same revision checked out in repo a and ua:
329 329
330 330 $ hg -R a parents --template "{node|short}\n"
331 331 e8ece76546a6
332 332 $ hg -R ua parents --template "{node|short}\n"
333 333 e8ece76546a6
334 334
335 335 $ rm -r ua
336 336
337 337
338 338 Testing clone -u <branch>:
339 339
340 340 $ hg clone -u stable a ua
341 341 updating to branch stable
342 342 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
343 343
344 344 Repo ua has both heads:
345 345
346 346 $ hg -R ua heads
347 347 changeset: 15:0aae7cf88f0d
348 348 branch: stable
349 349 tag: tip
350 350 user: test
351 351 date: Thu Jan 01 00:00:00 1970 +0000
352 352 summary: another change for branch stable
353 353
354 354 changeset: 12:f21241060d6a
355 355 user: test
356 356 date: Thu Jan 01 00:00:00 1970 +0000
357 357 summary: hacked default
358 358
359 359
360 360 Branch 'stable' is checked out:
361 361
362 362 $ hg -R ua parents
363 363 changeset: 15:0aae7cf88f0d
364 364 branch: stable
365 365 tag: tip
366 366 user: test
367 367 date: Thu Jan 01 00:00:00 1970 +0000
368 368 summary: another change for branch stable
369 369
370 370
371 371 $ rm -r ua
372 372
373 373
374 374 Testing default checkout:
375 375
376 376 $ hg clone a ua
377 377 updating to branch default
378 378 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
379 379
380 380 Repo ua has both heads:
381 381
382 382 $ hg -R ua heads
383 383 changeset: 15:0aae7cf88f0d
384 384 branch: stable
385 385 tag: tip
386 386 user: test
387 387 date: Thu Jan 01 00:00:00 1970 +0000
388 388 summary: another change for branch stable
389 389
390 390 changeset: 12:f21241060d6a
391 391 user: test
392 392 date: Thu Jan 01 00:00:00 1970 +0000
393 393 summary: hacked default
394 394
395 395
396 396 Branch 'default' is checked out:
397 397
398 398 $ hg -R ua parents
399 399 changeset: 12:f21241060d6a
400 400 user: test
401 401 date: Thu Jan 01 00:00:00 1970 +0000
402 402 summary: hacked default
403 403
404 404 Test clone with a branch named "@" (issue3677)
405 405
406 406 $ hg -R ua branch @
407 407 marked working directory as branch @
408 408 $ hg -R ua commit -m 'created branch @'
409 409 $ hg clone ua atbranch
410 410 updating to branch default
411 411 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
412 412 $ hg -R atbranch heads
413 413 changeset: 16:798b6d97153e
414 414 branch: @
415 415 tag: tip
416 416 parent: 12:f21241060d6a
417 417 user: test
418 418 date: Thu Jan 01 00:00:00 1970 +0000
419 419 summary: created branch @
420 420
421 421 changeset: 15:0aae7cf88f0d
422 422 branch: stable
423 423 user: test
424 424 date: Thu Jan 01 00:00:00 1970 +0000
425 425 summary: another change for branch stable
426 426
427 427 changeset: 12:f21241060d6a
428 428 user: test
429 429 date: Thu Jan 01 00:00:00 1970 +0000
430 430 summary: hacked default
431 431
432 432 $ hg -R atbranch parents
433 433 changeset: 12:f21241060d6a
434 434 user: test
435 435 date: Thu Jan 01 00:00:00 1970 +0000
436 436 summary: hacked default
437 437
438 438
439 439 $ rm -r ua atbranch
440 440
441 441
442 442 Testing #<branch>:
443 443
444 444 $ hg clone -u . a#stable ua
445 445 adding changesets
446 446 adding manifests
447 447 adding file changes
448 448 added 14 changesets with 14 changes to 3 files
449 449 new changesets acb14030fe0a:0aae7cf88f0d
450 450 updating to branch stable
451 451 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
452 452
453 453 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
454 454
455 455 $ hg -R ua heads
456 456 changeset: 13:0aae7cf88f0d
457 457 branch: stable
458 458 tag: tip
459 459 user: test
460 460 date: Thu Jan 01 00:00:00 1970 +0000
461 461 summary: another change for branch stable
462 462
463 463 changeset: 10:a7949464abda
464 464 user: test
465 465 date: Thu Jan 01 00:00:00 1970 +0000
466 466 summary: test
467 467
468 468
469 469 Same revision checked out in repo a and ua:
470 470
471 471 $ hg -R a parents --template "{node|short}\n"
472 472 e8ece76546a6
473 473 $ hg -R ua parents --template "{node|short}\n"
474 474 e8ece76546a6
475 475
476 476 $ rm -r ua
477 477
478 478
479 479 Testing -u -r <branch>:
480 480
481 481 $ hg clone -u . -r stable a ua
482 482 adding changesets
483 483 adding manifests
484 484 adding file changes
485 485 added 14 changesets with 14 changes to 3 files
486 486 new changesets acb14030fe0a:0aae7cf88f0d
487 487 updating to branch stable
488 488 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
489 489
490 490 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
491 491
492 492 $ hg -R ua heads
493 493 changeset: 13:0aae7cf88f0d
494 494 branch: stable
495 495 tag: tip
496 496 user: test
497 497 date: Thu Jan 01 00:00:00 1970 +0000
498 498 summary: another change for branch stable
499 499
500 500 changeset: 10:a7949464abda
501 501 user: test
502 502 date: Thu Jan 01 00:00:00 1970 +0000
503 503 summary: test
504 504
505 505
506 506 Same revision checked out in repo a and ua:
507 507
508 508 $ hg -R a parents --template "{node|short}\n"
509 509 e8ece76546a6
510 510 $ hg -R ua parents --template "{node|short}\n"
511 511 e8ece76546a6
512 512
513 513 $ rm -r ua
514 514
515 515
516 516 Testing -r <branch>:
517 517
518 518 $ hg clone -r stable a ua
519 519 adding changesets
520 520 adding manifests
521 521 adding file changes
522 522 added 14 changesets with 14 changes to 3 files
523 523 new changesets acb14030fe0a:0aae7cf88f0d
524 524 updating to branch stable
525 525 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
526 526
527 527 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
528 528
529 529 $ hg -R ua heads
530 530 changeset: 13:0aae7cf88f0d
531 531 branch: stable
532 532 tag: tip
533 533 user: test
534 534 date: Thu Jan 01 00:00:00 1970 +0000
535 535 summary: another change for branch stable
536 536
537 537 changeset: 10:a7949464abda
538 538 user: test
539 539 date: Thu Jan 01 00:00:00 1970 +0000
540 540 summary: test
541 541
542 542
543 543 Branch 'stable' is checked out:
544 544
545 545 $ hg -R ua parents
546 546 changeset: 13:0aae7cf88f0d
547 547 branch: stable
548 548 tag: tip
549 549 user: test
550 550 date: Thu Jan 01 00:00:00 1970 +0000
551 551 summary: another change for branch stable
552 552
553 553
554 554 $ rm -r ua
555 555
556 556
557 557 Issue2267: Error in 1.6 hg.py: TypeError: 'NoneType' object is not
558 558 iterable in addbranchrevs()
559 559
560 560 $ cat <<EOF > simpleclone.py
561 561 > from mercurial import ui, hg
562 562 > myui = ui.ui.load()
563 563 > repo = hg.repository(myui, b'a')
564 564 > hg.clone(myui, {}, repo, dest=b"ua")
565 565 > EOF
566 566
567 567 $ $PYTHON simpleclone.py
568 568 updating to branch default
569 569 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
570 570
571 571 $ rm -r ua
572 572
573 573 $ cat <<EOF > branchclone.py
574 574 > from mercurial import ui, hg, extensions
575 575 > myui = ui.ui.load()
576 576 > extensions.loadall(myui)
577 577 > repo = hg.repository(myui, b'a')
578 578 > hg.clone(myui, {}, repo, dest=b"ua", branch=[b"stable",])
579 579 > EOF
580 580
581 581 $ $PYTHON branchclone.py
582 582 adding changesets
583 583 adding manifests
584 584 adding file changes
585 585 added 14 changesets with 14 changes to 3 files
586 586 new changesets acb14030fe0a:0aae7cf88f0d
587 587 updating to branch stable
588 588 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
589 589 $ rm -r ua
590 590
591 591
592 592 Test clone with special '@' bookmark:
593 593 $ cd a
594 594 $ hg bookmark -r a7949464abda @ # branch point of stable from default
595 595 $ hg clone . ../i
596 596 updating to bookmark @
597 597 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
598 598 $ hg id -i ../i
599 599 a7949464abda
600 600 $ rm -r ../i
601 601
602 602 $ hg bookmark -f -r stable @
603 603 $ hg bookmarks
604 604 @ 15:0aae7cf88f0d
605 605 $ hg clone . ../i
606 606 updating to bookmark @ on branch stable
607 607 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
608 608 $ hg id -i ../i
609 609 0aae7cf88f0d
610 610 $ cd "$TESTTMP"
611 611
612 612
613 613 Testing failures:
614 614
615 615 $ mkdir fail
616 616 $ cd fail
617 617
618 618 No local source
619 619
620 620 $ hg clone a b
621 621 abort: repository a not found!
622 622 [255]
623 623
624 624 No remote source
625 625
626 626 #if windows
627 627 $ hg clone http://$LOCALIP:3121/a b
628 628 abort: error: * (glob)
629 629 [255]
630 630 #else
631 631 $ hg clone http://$LOCALIP:3121/a b
632 632 abort: error: *refused* (glob)
633 633 [255]
634 634 #endif
635 635 $ rm -rf b # work around bug with http clone
636 636
637 637
638 638 #if unix-permissions no-root
639 639
640 640 Inaccessible source
641 641
642 642 $ mkdir a
643 643 $ chmod 000 a
644 644 $ hg clone a b
645 645 abort: Permission denied: '$TESTTMP/fail/a/.hg'
646 646 [255]
647 647
648 648 Inaccessible destination
649 649
650 650 $ hg init b
651 651 $ cd b
652 652 $ hg clone . ../a
653 653 abort: Permission denied: '../a'
654 654 [255]
655 655 $ cd ..
656 656 $ chmod 700 a
657 657 $ rm -r a b
658 658
659 659 #endif
660 660
661 661
662 662 #if fifo
663 663
664 664 Source of wrong type
665 665
666 666 $ mkfifo a
667 667 $ hg clone a b
668 668 abort: $ENOTDIR$: '$TESTTMP/fail/a/.hg'
669 669 [255]
670 670 $ rm a
671 671
672 672 #endif
673 673
674 674 Default destination, same directory
675 675
676 676 $ hg init q
677 677 $ hg clone q
678 678 destination directory: q
679 679 abort: destination 'q' is not empty
680 680 [255]
681 681
682 682 destination directory not empty
683 683
684 684 $ mkdir a
685 685 $ echo stuff > a/a
686 686 $ hg clone q a
687 687 abort: destination 'a' is not empty
688 688 [255]
689 689
690 690
691 691 #if unix-permissions no-root
692 692
693 693 leave existing directory in place after clone failure
694 694
695 695 $ hg init c
696 696 $ cd c
697 697 $ echo c > c
698 698 $ hg commit -A -m test
699 699 adding c
700 700 $ chmod -rx .hg/store/data
701 701 $ cd ..
702 702 $ mkdir d
703 703 $ hg clone c d 2> err
704 704 [255]
705 705 $ test -d d
706 706 $ test -d d/.hg
707 707 [1]
708 708
709 709 re-enable perm to allow deletion
710 710
711 711 $ chmod +rx c/.hg/store/data
712 712
713 713 #endif
714 714
715 715 $ cd ..
716 716
717 717 Test clone from the repository in (emulated) revlog format 0 (issue4203):
718 718
719 719 $ mkdir issue4203
720 720 $ mkdir -p src/.hg
721 721 $ echo foo > src/foo
722 722 $ hg -R src add src/foo
723 723 $ hg -R src commit -m '#0'
724 724 $ hg -R src log -q
725 725 0:e1bab28bca43
726 726 $ hg clone -U -q src dst
727 727 $ hg -R dst log -q
728 728 0:e1bab28bca43
729 729
730 730 Create repositories to test auto sharing functionality
731 731
732 732 $ cat >> $HGRCPATH << EOF
733 733 > [extensions]
734 734 > share=
735 735 > EOF
736 736
737 737 $ hg init empty
738 738 $ hg init source1a
739 739 $ cd source1a
740 740 $ echo initial1 > foo
741 741 $ hg -q commit -A -m initial
742 742 $ echo second > foo
743 743 $ hg commit -m second
744 744 $ cd ..
745 745
746 746 $ hg init filteredrev0
747 747 $ cd filteredrev0
748 748 $ cat >> .hg/hgrc << EOF
749 749 > [experimental]
750 750 > evolution.createmarkers=True
751 751 > EOF
752 752 $ echo initial1 > foo
753 753 $ hg -q commit -A -m initial0
754 754 $ hg -q up -r null
755 755 $ echo initial2 > foo
756 756 $ hg -q commit -A -m initial1
757 757 $ hg debugobsolete c05d5c47a5cf81401869999f3d05f7d699d2b29a e082c1832e09a7d1e78b7fd49a592d372de854c8
758 758 obsoleted 1 changesets
759 759 $ cd ..
760 760
761 761 $ hg -q clone --pull source1a source1b
762 762 $ cd source1a
763 763 $ hg bookmark bookA
764 764 $ echo 1a > foo
765 765 $ hg commit -m 1a
766 766 $ cd ../source1b
767 767 $ hg -q up -r 0
768 768 $ echo head1 > foo
769 769 $ hg commit -m head1
770 770 created new head
771 771 $ hg bookmark head1
772 772 $ hg -q up -r 0
773 773 $ echo head2 > foo
774 774 $ hg commit -m head2
775 775 created new head
776 776 $ hg bookmark head2
777 777 $ hg -q up -r 0
778 778 $ hg branch branch1
779 779 marked working directory as branch branch1
780 780 (branches are permanent and global, did you want a bookmark?)
781 781 $ echo branch1 > foo
782 782 $ hg commit -m branch1
783 783 $ hg -q up -r 0
784 784 $ hg branch branch2
785 785 marked working directory as branch branch2
786 786 $ echo branch2 > foo
787 787 $ hg commit -m branch2
788 788 $ cd ..
789 789 $ hg init source2
790 790 $ cd source2
791 791 $ echo initial2 > foo
792 792 $ hg -q commit -A -m initial2
793 793 $ echo second > foo
794 794 $ hg commit -m second
795 795 $ cd ..
796 796
797 797 Clone with auto share from an empty repo should not result in share
798 798
799 799 $ mkdir share
800 800 $ hg --config share.pool=share clone empty share-empty
801 801 (not using pooled storage: remote appears to be empty)
802 802 updating to branch default
803 803 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
804 804 $ ls share
805 805 $ test -d share-empty/.hg/store
806 806 $ test -f share-empty/.hg/sharedpath
807 807 [1]
808 808
809 809 Clone with auto share from a repo with filtered revision 0 should not result in share
810 810
811 811 $ hg --config share.pool=share clone filteredrev0 share-filtered
812 812 (not using pooled storage: unable to resolve identity of remote)
813 813 requesting all changes
814 814 adding changesets
815 815 adding manifests
816 816 adding file changes
817 817 added 1 changesets with 1 changes to 1 files
818 818 new changesets e082c1832e09
819 819 updating to branch default
820 820 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
821 821
822 822 Clone from repo with content should result in shared store being created
823 823
824 824 $ hg --config share.pool=share clone source1a share-dest1a
825 825 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
826 826 requesting all changes
827 827 adding changesets
828 828 adding manifests
829 829 adding file changes
830 830 added 3 changesets with 3 changes to 1 files
831 831 new changesets b5f04eac9d8f:e5bfe23c0b47
832 832 searching for changes
833 833 no changes found
834 834 adding remote bookmark bookA
835 835 updating working directory
836 836 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
837 837
838 838 The shared repo should have been created
839 839
840 840 $ ls share
841 841 b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
842 842
843 843 The destination should point to it
844 844
845 845 $ cat share-dest1a/.hg/sharedpath; echo
846 846 $TESTTMP/share/b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1/.hg
847 847
848 848 The destination should have bookmarks
849 849
850 850 $ hg -R share-dest1a bookmarks
851 851 bookA 2:e5bfe23c0b47
852 852
853 853 The default path should be the remote, not the share
854 854
855 855 $ hg -R share-dest1a config paths.default
856 856 $TESTTMP/source1a
857 857
858 858 Clone with existing share dir should result in pull + share
859 859
860 860 $ hg --config share.pool=share clone source1b share-dest1b
861 861 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
862 862 searching for changes
863 863 adding changesets
864 864 adding manifests
865 865 adding file changes
866 866 added 4 changesets with 4 changes to 1 files (+4 heads)
867 867 adding remote bookmark head1
868 868 adding remote bookmark head2
869 869 new changesets 4a8dc1ab4c13:6bacf4683960
870 870 updating working directory
871 871 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
872 872
873 873 $ ls share
874 874 b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
875 875
876 876 $ cat share-dest1b/.hg/sharedpath; echo
877 877 $TESTTMP/share/b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1/.hg
878 878
879 879 We only get bookmarks from the remote, not everything in the share
880 880
881 881 $ hg -R share-dest1b bookmarks
882 882 head1 3:4a8dc1ab4c13
883 883 head2 4:99f71071f117
884 884
885 885 Default path should be source, not share.
886 886
887 887 $ hg -R share-dest1b config paths.default
888 888 $TESTTMP/source1b
889 889
890 890 Checked out revision should be head of default branch
891 891
892 892 $ hg -R share-dest1b log -r .
893 893 changeset: 4:99f71071f117
894 894 bookmark: head2
895 895 parent: 0:b5f04eac9d8f
896 896 user: test
897 897 date: Thu Jan 01 00:00:00 1970 +0000
898 898 summary: head2
899 899
900 900
901 901 Clone from unrelated repo should result in new share
902 902
903 903 $ hg --config share.pool=share clone source2 share-dest2
904 904 (sharing from new pooled repository 22aeff664783fd44c6d9b435618173c118c3448e)
905 905 requesting all changes
906 906 adding changesets
907 907 adding manifests
908 908 adding file changes
909 909 added 2 changesets with 2 changes to 1 files
910 910 new changesets 22aeff664783:63cf6c3dba4a
911 911 searching for changes
912 912 no changes found
913 913 updating working directory
914 914 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
915 915
916 916 $ ls share
917 917 22aeff664783fd44c6d9b435618173c118c3448e
918 918 b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
919 919
920 920 remote naming mode works as advertised
921 921
922 922 $ hg --config share.pool=shareremote --config share.poolnaming=remote clone source1a share-remote1a
923 923 (sharing from new pooled repository 195bb1fcdb595c14a6c13e0269129ed78f6debde)
924 924 requesting all changes
925 925 adding changesets
926 926 adding manifests
927 927 adding file changes
928 928 added 3 changesets with 3 changes to 1 files
929 929 new changesets b5f04eac9d8f:e5bfe23c0b47
930 930 searching for changes
931 931 no changes found
932 932 adding remote bookmark bookA
933 933 updating working directory
934 934 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
935 935
936 936 $ ls shareremote
937 937 195bb1fcdb595c14a6c13e0269129ed78f6debde
938 938
939 939 $ hg --config share.pool=shareremote --config share.poolnaming=remote clone source1b share-remote1b
940 940 (sharing from new pooled repository c0d4f83847ca2a873741feb7048a45085fd47c46)
941 941 requesting all changes
942 942 adding changesets
943 943 adding manifests
944 944 adding file changes
945 945 added 6 changesets with 6 changes to 1 files (+4 heads)
946 946 new changesets b5f04eac9d8f:6bacf4683960
947 947 searching for changes
948 948 no changes found
949 949 adding remote bookmark head1
950 950 adding remote bookmark head2
951 951 updating working directory
952 952 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
953 953
954 954 $ ls shareremote
955 955 195bb1fcdb595c14a6c13e0269129ed78f6debde
956 956 c0d4f83847ca2a873741feb7048a45085fd47c46
957 957
958 958 request to clone a single revision is respected in sharing mode
959 959
960 960 $ hg --config share.pool=sharerevs clone -r 4a8dc1ab4c13 source1b share-1arev
961 961 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
962 962 adding changesets
963 963 adding manifests
964 964 adding file changes
965 965 added 2 changesets with 2 changes to 1 files
966 966 new changesets b5f04eac9d8f:4a8dc1ab4c13
967 967 no changes found
968 968 adding remote bookmark head1
969 969 updating working directory
970 970 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
971 971
972 972 $ hg -R share-1arev log -G
973 973 @ changeset: 1:4a8dc1ab4c13
974 974 | bookmark: head1
975 975 | tag: tip
976 976 | user: test
977 977 | date: Thu Jan 01 00:00:00 1970 +0000
978 978 | summary: head1
979 979 |
980 980 o changeset: 0:b5f04eac9d8f
981 981 user: test
982 982 date: Thu Jan 01 00:00:00 1970 +0000
983 983 summary: initial
984 984
985 985
986 986 making another clone should only pull down requested rev
987 987
988 988 $ hg --config share.pool=sharerevs clone -r 99f71071f117 source1b share-1brev
989 989 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
990 990 searching for changes
991 991 adding changesets
992 992 adding manifests
993 993 adding file changes
994 994 added 1 changesets with 1 changes to 1 files (+1 heads)
995 995 adding remote bookmark head1
996 996 adding remote bookmark head2
997 997 new changesets 99f71071f117
998 998 updating working directory
999 999 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1000 1000
1001 1001 $ hg -R share-1brev log -G
1002 1002 @ changeset: 2:99f71071f117
1003 1003 | bookmark: head2
1004 1004 | tag: tip
1005 1005 | parent: 0:b5f04eac9d8f
1006 1006 | user: test
1007 1007 | date: Thu Jan 01 00:00:00 1970 +0000
1008 1008 | summary: head2
1009 1009 |
1010 1010 | o changeset: 1:4a8dc1ab4c13
1011 1011 |/ bookmark: head1
1012 1012 | user: test
1013 1013 | date: Thu Jan 01 00:00:00 1970 +0000
1014 1014 | summary: head1
1015 1015 |
1016 1016 o changeset: 0:b5f04eac9d8f
1017 1017 user: test
1018 1018 date: Thu Jan 01 00:00:00 1970 +0000
1019 1019 summary: initial
1020 1020
1021 1021
1022 1022 Request to clone a single branch is respected in sharing mode
1023 1023
1024 1024 $ hg --config share.pool=sharebranch clone -b branch1 source1b share-1bbranch1
1025 1025 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1026 1026 adding changesets
1027 1027 adding manifests
1028 1028 adding file changes
1029 1029 added 2 changesets with 2 changes to 1 files
1030 1030 new changesets b5f04eac9d8f:5f92a6c1a1b1
1031 1031 no changes found
1032 1032 updating working directory
1033 1033 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1034 1034
1035 1035 $ hg -R share-1bbranch1 log -G
1036 1036 o changeset: 1:5f92a6c1a1b1
1037 1037 | branch: branch1
1038 1038 | tag: tip
1039 1039 | user: test
1040 1040 | date: Thu Jan 01 00:00:00 1970 +0000
1041 1041 | summary: branch1
1042 1042 |
1043 1043 @ changeset: 0:b5f04eac9d8f
1044 1044 user: test
1045 1045 date: Thu Jan 01 00:00:00 1970 +0000
1046 1046 summary: initial
1047 1047
1048 1048
1049 1049 $ hg --config share.pool=sharebranch clone -b branch2 source1b share-1bbranch2
1050 1050 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1051 1051 searching for changes
1052 1052 adding changesets
1053 1053 adding manifests
1054 1054 adding file changes
1055 1055 added 1 changesets with 1 changes to 1 files (+1 heads)
1056 1056 new changesets 6bacf4683960
1057 1057 updating working directory
1058 1058 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1059 1059
1060 1060 $ hg -R share-1bbranch2 log -G
1061 1061 o changeset: 2:6bacf4683960
1062 1062 | branch: branch2
1063 1063 | tag: tip
1064 1064 | parent: 0:b5f04eac9d8f
1065 1065 | user: test
1066 1066 | date: Thu Jan 01 00:00:00 1970 +0000
1067 1067 | summary: branch2
1068 1068 |
1069 1069 | o changeset: 1:5f92a6c1a1b1
1070 1070 |/ branch: branch1
1071 1071 | user: test
1072 1072 | date: Thu Jan 01 00:00:00 1970 +0000
1073 1073 | summary: branch1
1074 1074 |
1075 1075 @ changeset: 0:b5f04eac9d8f
1076 1076 user: test
1077 1077 date: Thu Jan 01 00:00:00 1970 +0000
1078 1078 summary: initial
1079 1079
1080 1080
1081 1081 -U is respected in share clone mode
1082 1082
1083 1083 $ hg --config share.pool=share clone -U source1a share-1anowc
1084 1084 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1085 1085 searching for changes
1086 1086 no changes found
1087 1087 adding remote bookmark bookA
1088 1088
1089 1089 $ ls share-1anowc
1090 1090
1091 1091 Test that auto sharing doesn't cause failure of "hg clone local remote"
1092 1092
1093 1093 $ cd $TESTTMP
1094 1094 $ hg -R a id -r 0
1095 1095 acb14030fe0a
1096 1096 $ hg id -R remote -r 0
1097 1097 abort: repository remote not found!
1098 1098 [255]
1099 1099 $ hg --config share.pool=share -q clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" a ssh://user@dummy/remote
1100 1100 $ hg -R remote id -r 0
1101 1101 acb14030fe0a
1102 1102
1103 1103 Cloning into pooled storage doesn't race (issue5104)
1104 1104
1105 1105 $ HGPOSTLOCKDELAY=2.0 hg --config share.pool=racepool --config extensions.lockdelay=$TESTDIR/lockdelay.py clone source1a share-destrace1 > race1.log 2>&1 &
1106 1106 $ HGPRELOCKDELAY=1.0 hg --config share.pool=racepool --config extensions.lockdelay=$TESTDIR/lockdelay.py clone source1a share-destrace2 > race2.log 2>&1
1107 1107 $ wait
1108 1108
1109 1109 $ hg -R share-destrace1 log -r tip
1110 1110 changeset: 2:e5bfe23c0b47
1111 1111 bookmark: bookA
1112 1112 tag: tip
1113 1113 user: test
1114 1114 date: Thu Jan 01 00:00:00 1970 +0000
1115 1115 summary: 1a
1116 1116
1117 1117
1118 1118 $ hg -R share-destrace2 log -r tip
1119 1119 changeset: 2:e5bfe23c0b47
1120 1120 bookmark: bookA
1121 1121 tag: tip
1122 1122 user: test
1123 1123 date: Thu Jan 01 00:00:00 1970 +0000
1124 1124 summary: 1a
1125 1125
1126 1126 One repo should be new, the other should be shared from the pool. We
1127 1127 don't care which is which, so we just make sure we always print the
1128 1128 one containing "new pooled" first, then one one containing "existing
1129 1129 pooled".
1130 1130
1131 1131 $ (grep 'new pooled' race1.log > /dev/null && cat race1.log || cat race2.log) | grep -v lock
1132 1132 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1133 1133 requesting all changes
1134 1134 adding changesets
1135 1135 adding manifests
1136 1136 adding file changes
1137 1137 added 3 changesets with 3 changes to 1 files
1138 1138 new changesets b5f04eac9d8f:e5bfe23c0b47
1139 1139 searching for changes
1140 1140 no changes found
1141 1141 adding remote bookmark bookA
1142 1142 updating working directory
1143 1143 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1144 1144
1145 1145 $ (grep 'existing pooled' race1.log > /dev/null && cat race1.log || cat race2.log) | grep -v lock
1146 1146 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1147 1147 searching for changes
1148 1148 no changes found
1149 1149 adding remote bookmark bookA
1150 1150 updating working directory
1151 1151 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1152 1152
1153 1153 SEC: check for unsafe ssh url
1154 1154
1155 1155 $ cat >> $HGRCPATH << EOF
1156 1156 > [ui]
1157 1157 > ssh = sh -c "read l; read l; read l"
1158 1158 > EOF
1159 1159
1160 1160 $ hg clone 'ssh://-oProxyCommand=touch${IFS}owned/path'
1161 1161 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path'
1162 1162 [255]
1163 1163 $ hg clone 'ssh://%2DoProxyCommand=touch${IFS}owned/path'
1164 1164 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path'
1165 1165 [255]
1166 1166 $ hg clone 'ssh://fakehost|touch%20owned/path'
1167 1167 abort: no suitable response from remote hg!
1168 1168 [255]
1169 1169 $ hg clone 'ssh://fakehost%7Ctouch%20owned/path'
1170 1170 abort: no suitable response from remote hg!
1171 1171 [255]
1172 1172
1173 1173 $ hg clone 'ssh://-oProxyCommand=touch owned%20foo@example.com/nonexistent/path'
1174 1174 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch owned foo@example.com/nonexistent/path'
1175 1175 [255]
1176 1176
1177 1177 #if windows
1178 1178 $ hg clone "ssh://%26touch%20owned%20/" --debug
1179 1179 running sh -c "read l; read l; read l" "&touch owned " "hg -R . serve --stdio"
1180 1180 sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !)
1181 1181 sending hello command
1182 1182 sending between command
1183 1183 abort: no suitable response from remote hg!
1184 1184 [255]
1185 1185 $ hg clone "ssh://example.com:%26touch%20owned%20/" --debug
1186 1186 running sh -c "read l; read l; read l" -p "&touch owned " example.com "hg -R . serve --stdio"
1187 1187 sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !)
1188 1188 sending hello command
1189 1189 sending between command
1190 1190 abort: no suitable response from remote hg!
1191 1191 [255]
1192 1192 #else
1193 1193 $ hg clone "ssh://%3btouch%20owned%20/" --debug
1194 1194 running sh -c "read l; read l; read l" ';touch owned ' 'hg -R . serve --stdio'
1195 1195 sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !)
1196 1196 sending hello command
1197 1197 sending between command
1198 1198 abort: no suitable response from remote hg!
1199 1199 [255]
1200 1200 $ hg clone "ssh://example.com:%3btouch%20owned%20/" --debug
1201 1201 running sh -c "read l; read l; read l" -p ';touch owned ' example.com 'hg -R . serve --stdio'
1202 1202 sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !)
1203 1203 sending hello command
1204 1204 sending between command
1205 1205 abort: no suitable response from remote hg!
1206 1206 [255]
1207 1207 #endif
1208 1208
1209 1209 $ hg clone "ssh://v-alid.example.com/" --debug
1210 1210 running sh -c "read l; read l; read l" v-alid\.example\.com ['"]hg -R \. serve --stdio['"] (re)
1211 1211 sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !)
1212 1212 sending hello command
1213 1213 sending between command
1214 1214 abort: no suitable response from remote hg!
1215 1215 [255]
1216 1216
1217 1217 We should not have created a file named owned - if it exists, the
1218 1218 attack succeeded.
1219 1219 $ if test -f owned; then echo 'you got owned'; fi
1220 1220
1221 1221 Cloning without fsmonitor enabled does not print a warning for small repos
1222 1222
1223 1223 $ hg clone a fsmonitor-default
1224 1224 updating to bookmark @ on branch stable
1225 1225 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1226 1226
1227 1227 Lower the warning threshold to simulate a large repo
1228 1228
1229 1229 $ cat >> $HGRCPATH << EOF
1230 1230 > [fsmonitor]
1231 1231 > warn_update_file_count = 2
1232 1232 > EOF
1233 1233
1234 1234 We should see a warning about no fsmonitor on supported platforms
1235 1235
1236 1236 #if linuxormacos no-fsmonitor
1237 1237 $ hg clone a nofsmonitor
1238 1238 updating to bookmark @ on branch stable
1239 1239 (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor")
1240 1240 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1241 1241 #else
1242 1242 $ hg clone a nofsmonitor
1243 1243 updating to bookmark @ on branch stable
1244 1244 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1245 1245 #endif
1246 1246
1247 1247 We should not see warning about fsmonitor when it is enabled
1248 1248
1249 1249 #if fsmonitor
1250 1250 $ hg clone a fsmonitor-enabled
1251 1251 updating to bookmark @ on branch stable
1252 1252 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1253 1253 #endif
1254 1254
1255 1255 We can disable the fsmonitor warning
1256 1256
1257 1257 $ hg --config fsmonitor.warn_when_unused=false clone a fsmonitor-disable-warning
1258 1258 updating to bookmark @ on branch stable
1259 1259 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1260 1260
1261 1261 Loaded fsmonitor but disabled in config should still print warning
1262 1262
1263 1263 #if linuxormacos fsmonitor
1264 1264 $ hg --config fsmonitor.mode=off clone a fsmonitor-mode-off
1265 1265 updating to bookmark @ on branch stable
1266 1266 (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor") (fsmonitor !)
1267 1267 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1268 1268 #endif
1269 1269
1270 1270 Warning not printed if working directory isn't empty
1271 1271
1272 1272 $ hg -q clone a fsmonitor-update
1273 1273 (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor") (?)
1274 1274 $ cd fsmonitor-update
1275 1275 $ hg up acb14030fe0a
1276 1276 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1277 1277 (leaving bookmark @)
1278 1278 $ hg up cf0fe1914066
1279 1279 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1280 1280
1281 1281 `hg update` from null revision also prints
1282 1282
1283 1283 $ hg up null
1284 1284 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1285 1285
1286 1286 #if linuxormacos no-fsmonitor
1287 1287 $ hg up cf0fe1914066
1288 1288 (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor")
1289 1289 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1290 1290 #else
1291 1291 $ hg up cf0fe1914066
1292 1292 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1293 1293 #endif
1294 1294
1295 1295 $ cd ..
1296 1296
@@ -1,619 +1,619 b''
1 1 $ cat << EOF >> $HGRCPATH
2 2 > [ui]
3 3 > interactive=yes
4 4 > EOF
5 5
6 6 $ hg init debugrevlog
7 7 $ cd debugrevlog
8 8 $ echo a > a
9 9 $ hg ci -Am adda
10 10 adding a
11 11 $ hg rm .
12 12 removing a
13 13 $ hg ci -Am make-it-empty
14 14 $ hg revert --all -r 0
15 15 adding a
16 16 $ hg ci -Am make-it-full
17 17 #if reporevlogstore
18 18 $ hg debugrevlog -c
19 19 format : 1
20 20 flags : inline
21 21
22 22 revisions : 3
23 23 merges : 0 ( 0.00%)
24 24 normal : 3 (100.00%)
25 25 revisions : 3
26 26 empty : 0 ( 0.00%)
27 27 text : 0 (100.00%)
28 28 delta : 0 (100.00%)
29 29 snapshot : 3 (100.00%)
30 30 lvl-0 : 3 (100.00%)
31 31 deltas : 0 ( 0.00%)
32 32 revision size : 191
33 33 snapshot : 191 (100.00%)
34 34 lvl-0 : 191 (100.00%)
35 35 deltas : 0 ( 0.00%)
36 36
37 37 chunks : 3
38 38 0x75 (u) : 3 (100.00%)
39 39 chunks size : 191
40 40 0x75 (u) : 191 (100.00%)
41 41
42 42 avg chain length : 0
43 43 max chain length : 0
44 44 max chain reach : 67
45 45 compression ratio : 0
46 46
47 47 uncompressed data size (min/max/avg) : 57 / 66 / 62
48 48 full revision size (min/max/avg) : 58 / 67 / 63
49 49 inter-snapshot size (min/max/avg) : 0 / 0 / 0
50 50 delta size (min/max/avg) : 0 / 0 / 0
51 51 $ hg debugrevlog -m
52 52 format : 1
53 53 flags : inline, generaldelta
54 54
55 55 revisions : 3
56 56 merges : 0 ( 0.00%)
57 57 normal : 3 (100.00%)
58 58 revisions : 3
59 59 empty : 1 (33.33%)
60 60 text : 1 (100.00%)
61 61 delta : 0 ( 0.00%)
62 62 snapshot : 2 (66.67%)
63 63 lvl-0 : 2 (66.67%)
64 64 deltas : 0 ( 0.00%)
65 65 revision size : 88
66 66 snapshot : 88 (100.00%)
67 67 lvl-0 : 88 (100.00%)
68 68 deltas : 0 ( 0.00%)
69 69
70 70 chunks : 3
71 71 empty : 1 (33.33%)
72 72 0x75 (u) : 2 (66.67%)
73 73 chunks size : 88
74 74 empty : 0 ( 0.00%)
75 75 0x75 (u) : 88 (100.00%)
76 76
77 77 avg chain length : 0
78 78 max chain length : 0
79 79 max chain reach : 44
80 80 compression ratio : 0
81 81
82 82 uncompressed data size (min/max/avg) : 0 / 43 / 28
83 83 full revision size (min/max/avg) : 44 / 44 / 44
84 84 inter-snapshot size (min/max/avg) : 0 / 0 / 0
85 85 delta size (min/max/avg) : 0 / 0 / 0
86 86 $ hg debugrevlog a
87 87 format : 1
88 88 flags : inline, generaldelta
89 89
90 90 revisions : 1
91 91 merges : 0 ( 0.00%)
92 92 normal : 1 (100.00%)
93 93 revisions : 1
94 94 empty : 0 ( 0.00%)
95 95 text : 0 (100.00%)
96 96 delta : 0 (100.00%)
97 97 snapshot : 1 (100.00%)
98 98 lvl-0 : 1 (100.00%)
99 99 deltas : 0 ( 0.00%)
100 100 revision size : 3
101 101 snapshot : 3 (100.00%)
102 102 lvl-0 : 3 (100.00%)
103 103 deltas : 0 ( 0.00%)
104 104
105 105 chunks : 1
106 106 0x75 (u) : 1 (100.00%)
107 107 chunks size : 3
108 108 0x75 (u) : 3 (100.00%)
109 109
110 110 avg chain length : 0
111 111 max chain length : 0
112 112 max chain reach : 3
113 113 compression ratio : 0
114 114
115 115 uncompressed data size (min/max/avg) : 2 / 2 / 2
116 116 full revision size (min/max/avg) : 3 / 3 / 3
117 117 inter-snapshot size (min/max/avg) : 0 / 0 / 0
118 118 delta size (min/max/avg) : 0 / 0 / 0
119 119 #endif
120 120
121 121 Test debugindex, with and without the --verbose/--debug flag
122 122 $ hg debugrevlogindex a
123 123 rev linkrev nodeid p1 p2
124 124 0 0 b789fdd96dc2 000000000000 000000000000
125 125
126 126 #if no-reposimplestore
127 127 $ hg --verbose debugrevlogindex a
128 128 rev offset length linkrev nodeid p1 p2
129 129 0 0 3 0 b789fdd96dc2 000000000000 000000000000
130 130
131 131 $ hg --debug debugrevlogindex a
132 132 rev offset length linkrev nodeid p1 p2
133 133 0 0 3 0 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
134 134 #endif
135 135
136 136 $ hg debugrevlogindex -f 1 a
137 137 rev flag size link p1 p2 nodeid
138 138 0 0000 2 0 -1 -1 b789fdd96dc2
139 139
140 140 #if no-reposimplestore
141 141 $ hg --verbose debugrevlogindex -f 1 a
142 142 rev flag offset length size link p1 p2 nodeid
143 143 0 0000 0 3 2 0 -1 -1 b789fdd96dc2
144 144
145 145 $ hg --debug debugrevlogindex -f 1 a
146 146 rev flag offset length size link p1 p2 nodeid
147 147 0 0000 0 3 2 0 -1 -1 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
148 148 #endif
149 149
150 150 $ hg debugindex -c
151 151 rev linkrev nodeid p1 p2
152 152 0 0 07f494440405 000000000000 000000000000
153 153 1 1 8cccb4b5fec2 07f494440405 000000000000
154 154 2 2 b1e228c512c5 8cccb4b5fec2 000000000000
155 155 $ hg debugindex -c --debug
156 156 rev linkrev nodeid p1 p2
157 157 0 0 07f4944404050f47db2e5c5071e0e84e7a27bba9 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
158 158 1 1 8cccb4b5fec20cafeb99dd01c26d4dee8ea4388a 07f4944404050f47db2e5c5071e0e84e7a27bba9 0000000000000000000000000000000000000000
159 159 2 2 b1e228c512c5d7066d70562ed839c3323a62d6d2 8cccb4b5fec20cafeb99dd01c26d4dee8ea4388a 0000000000000000000000000000000000000000
160 160 $ hg debugindex -m
161 161 rev linkrev nodeid p1 p2
162 162 0 0 a0c8bcbbb45c 000000000000 000000000000
163 163 1 1 57faf8a737ae a0c8bcbbb45c 000000000000
164 164 2 2 a35b10320954 57faf8a737ae 000000000000
165 165 $ hg debugindex -m --debug
166 166 rev linkrev nodeid p1 p2
167 167 0 0 a0c8bcbbb45c63b90b70ad007bf38961f64f2af0 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
168 168 1 1 57faf8a737ae7faf490582941a82319ba6529dca a0c8bcbbb45c63b90b70ad007bf38961f64f2af0 0000000000000000000000000000000000000000
169 169 2 2 a35b103209548032201c16c7688cb2657f037a38 57faf8a737ae7faf490582941a82319ba6529dca 0000000000000000000000000000000000000000
170 170 $ hg debugindex a
171 171 rev linkrev nodeid p1 p2
172 172 0 0 b789fdd96dc2 000000000000 000000000000
173 173 $ hg debugindex --debug a
174 174 rev linkrev nodeid p1 p2
175 175 0 0 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
176 176
177 177 debugdelta chain basic output
178 178
179 179 #if reporevlogstore
180 180 $ hg debugdeltachain -m
181 181 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
182 182 0 1 1 -1 base 44 43 44 1.02326 44 0 0.00000
183 183 1 2 1 -1 base 0 0 0 0.00000 0 0 0.00000
184 184 2 3 1 -1 base 44 43 44 1.02326 44 0 0.00000
185 185
186 186 $ hg debugdeltachain -m -T '{rev} {chainid} {chainlen}\n'
187 187 0 1 1
188 188 1 2 1
189 189 2 3 1
190 190
191 191 $ hg debugdeltachain -m -Tjson
192 192 [
193 193 {
194 194 "chainid": 1,
195 195 "chainlen": 1,
196 196 "chainratio": 1.02325581395,
197 197 "chainsize": 44,
198 198 "compsize": 44,
199 199 "deltatype": "base",
200 200 "extradist": 0,
201 201 "extraratio": 0.0,
202 202 "lindist": 44,
203 203 "prevrev": -1,
204 204 "rev": 0,
205 205 "uncompsize": 43
206 206 },
207 207 {
208 208 "chainid": 2,
209 209 "chainlen": 1,
210 210 "chainratio": 0,
211 211 "chainsize": 0,
212 212 "compsize": 0,
213 213 "deltatype": "base",
214 214 "extradist": 0,
215 215 "extraratio": 0,
216 216 "lindist": 0,
217 217 "prevrev": -1,
218 218 "rev": 1,
219 219 "uncompsize": 0
220 220 },
221 221 {
222 222 "chainid": 3,
223 223 "chainlen": 1,
224 224 "chainratio": 1.02325581395,
225 225 "chainsize": 44,
226 226 "compsize": 44,
227 227 "deltatype": "base",
228 228 "extradist": 0,
229 229 "extraratio": 0.0,
230 230 "lindist": 44,
231 231 "prevrev": -1,
232 232 "rev": 2,
233 233 "uncompsize": 43
234 234 }
235 235 ]
236 236
237 237 debugdelta chain with sparse read enabled
238 238
239 239 $ cat >> $HGRCPATH <<EOF
240 240 > [experimental]
241 241 > sparse-read = True
242 242 > EOF
243 243 $ hg debugdeltachain -m
244 244 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
245 245 0 1 1 -1 base 44 43 44 1.02326 44 0 0.00000 44 44 1.00000 1
246 246 1 2 1 -1 base 0 0 0 0.00000 0 0 0.00000 0 0 1.00000 1
247 247 2 3 1 -1 base 44 43 44 1.02326 44 0 0.00000 44 44 1.00000 1
248 248
249 249 $ hg debugdeltachain -m -T '{rev} {chainid} {chainlen} {readsize} {largestblock} {readdensity}\n'
250 250 0 1 1 44 44 1.0
251 251 1 2 1 0 0 1
252 252 2 3 1 44 44 1.0
253 253
254 254 $ hg debugdeltachain -m -Tjson
255 255 [
256 256 {
257 257 "chainid": 1,
258 258 "chainlen": 1,
259 259 "chainratio": 1.02325581395,
260 260 "chainsize": 44,
261 261 "compsize": 44,
262 262 "deltatype": "base",
263 263 "extradist": 0,
264 264 "extraratio": 0.0,
265 265 "largestblock": 44,
266 266 "lindist": 44,
267 267 "prevrev": -1,
268 268 "readdensity": 1.0,
269 269 "readsize": 44,
270 270 "rev": 0,
271 271 "srchunks": 1,
272 272 "uncompsize": 43
273 273 },
274 274 {
275 275 "chainid": 2,
276 276 "chainlen": 1,
277 277 "chainratio": 0,
278 278 "chainsize": 0,
279 279 "compsize": 0,
280 280 "deltatype": "base",
281 281 "extradist": 0,
282 282 "extraratio": 0,
283 283 "largestblock": 0,
284 284 "lindist": 0,
285 285 "prevrev": -1,
286 286 "readdensity": 1,
287 287 "readsize": 0,
288 288 "rev": 1,
289 289 "srchunks": 1,
290 290 "uncompsize": 0
291 291 },
292 292 {
293 293 "chainid": 3,
294 294 "chainlen": 1,
295 295 "chainratio": 1.02325581395,
296 296 "chainsize": 44,
297 297 "compsize": 44,
298 298 "deltatype": "base",
299 299 "extradist": 0,
300 300 "extraratio": 0.0,
301 301 "largestblock": 44,
302 302 "lindist": 44,
303 303 "prevrev": -1,
304 304 "readdensity": 1.0,
305 305 "readsize": 44,
306 306 "rev": 2,
307 307 "srchunks": 1,
308 308 "uncompsize": 43
309 309 }
310 310 ]
311 311
312 312 $ printf "This test checks things.\n" >> a
313 313 $ hg ci -m a
314 314 $ hg branch other
315 315 marked working directory as branch other
316 316 (branches are permanent and global, did you want a bookmark?)
317 317 $ for i in `$TESTDIR/seq.py 5`; do
318 318 > printf "shorter ${i}" >> a
319 319 > hg ci -m "a other:$i"
320 320 > hg up -q default
321 321 > printf "for the branch default we want longer chains: ${i}" >> a
322 322 > hg ci -m "a default:$i"
323 323 > hg up -q other
324 324 > done
325 325 $ hg debugdeltachain a -T '{rev} {srchunks}\n' \
326 326 > --config experimental.sparse-read.density-threshold=0.50 \
327 327 > --config experimental.sparse-read.min-gap-size=0
328 328 0 1
329 329 1 1
330 330 2 1
331 331 3 1
332 332 4 1
333 333 5 1
334 334 6 1
335 335 7 1
336 336 8 1
337 337 9 1
338 338 10 2
339 339 11 1
340 340 $ hg --config extensions.strip= strip --no-backup -r 1
341 341 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
342 342
343 343 Test max chain len
344 344 $ cat >> $HGRCPATH << EOF
345 345 > [format]
346 346 > maxchainlen=4
347 347 > EOF
348 348
349 349 $ printf "This test checks if maxchainlen config value is respected also it can serve as basic test for debugrevlog -d <file>.\n" >> a
350 350 $ hg ci -m a
351 351 $ printf "b\n" >> a
352 352 $ hg ci -m a
353 353 $ printf "c\n" >> a
354 354 $ hg ci -m a
355 355 $ printf "d\n" >> a
356 356 $ hg ci -m a
357 357 $ printf "e\n" >> a
358 358 $ hg ci -m a
359 359 $ printf "f\n" >> a
360 360 $ hg ci -m a
361 361 $ printf 'g\n' >> a
362 362 $ hg ci -m a
363 363 $ printf 'h\n' >> a
364 364 $ hg ci -m a
365 365
366 366 $ hg debugrevlog -d a
367 367 # rev p1rev p2rev start end deltastart base p1 p2 rawsize totalsize compression heads chainlen
368 368 0 -1 -1 0 ??? 0 0 0 0 ??? ???? ? 1 0 (glob)
369 369 1 0 -1 ??? ??? 0 0 0 0 ??? ???? ? 1 1 (glob)
370 370 2 1 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 2 (glob)
371 371 3 2 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 3 (glob)
372 372 4 3 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 4 (glob)
373 373 5 4 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 0 (glob)
374 374 6 5 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 1 (glob)
375 375 7 6 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 2 (glob)
376 376 8 7 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 3 (glob)
377 377 #endif
378 378
379 379 Test debuglocks command:
380 380
381 381 $ hg debuglocks
382 382 lock: free
383 383 wlock: free
384 384
385 385 * Test setting the lock
386 386
387 387 waitlock <file> will wait for file to be created. If it isn't in a reasonable
388 388 amount of time, displays error message and returns 1
389 389 $ waitlock() {
390 390 > start=`date +%s`
391 391 > timeout=5
392 392 > while [ \( ! -f $1 \) -a \( ! -L $1 \) ]; do
393 393 > now=`date +%s`
394 394 > if [ "`expr $now - $start`" -gt $timeout ]; then
395 395 > echo "timeout: $1 was not created in $timeout seconds"
396 396 > return 1
397 397 > fi
398 398 > sleep 0.1
399 399 > done
400 400 > }
401 401 $ dolock() {
402 402 > {
403 403 > waitlock .hg/unlock
404 404 > rm -f .hg/unlock
405 405 > echo y
406 406 > } | hg debuglocks "$@" > /dev/null
407 407 > }
408 408 $ dolock -s &
409 409 $ waitlock .hg/store/lock
410 410
411 411 $ hg debuglocks
412 412 lock: user *, process * (*s) (glob)
413 413 wlock: free
414 414 [1]
415 415 $ touch .hg/unlock
416 416 $ wait
417 417 $ [ -f .hg/store/lock ] || echo "There is no lock"
418 418 There is no lock
419 419
420 420 * Test setting the wlock
421 421
422 422 $ dolock -S &
423 423 $ waitlock .hg/wlock
424 424
425 425 $ hg debuglocks
426 426 lock: free
427 427 wlock: user *, process * (*s) (glob)
428 428 [1]
429 429 $ touch .hg/unlock
430 430 $ wait
431 431 $ [ -f .hg/wlock ] || echo "There is no wlock"
432 432 There is no wlock
433 433
434 434 * Test setting both locks
435 435
436 436 $ dolock -Ss &
437 437 $ waitlock .hg/wlock && waitlock .hg/store/lock
438 438
439 439 $ hg debuglocks
440 440 lock: user *, process * (*s) (glob)
441 441 wlock: user *, process * (*s) (glob)
442 442 [2]
443 443
444 444 * Test failing to set a lock
445 445
446 446 $ hg debuglocks -s
447 447 abort: lock is already held
448 448 [255]
449 449
450 450 $ hg debuglocks -S
451 451 abort: wlock is already held
452 452 [255]
453 453
454 454 $ touch .hg/unlock
455 455 $ wait
456 456
457 457 $ hg debuglocks
458 458 lock: free
459 459 wlock: free
460 460
461 461 * Test forcing the lock
462 462
463 463 $ dolock -s &
464 464 $ waitlock .hg/store/lock
465 465
466 466 $ hg debuglocks
467 467 lock: user *, process * (*s) (glob)
468 468 wlock: free
469 469 [1]
470 470
471 471 $ hg debuglocks -L
472 472
473 473 $ hg debuglocks
474 474 lock: free
475 475 wlock: free
476 476
477 477 $ touch .hg/unlock
478 478 $ wait
479 479
480 480 * Test forcing the wlock
481 481
482 482 $ dolock -S &
483 483 $ waitlock .hg/wlock
484 484
485 485 $ hg debuglocks
486 486 lock: free
487 487 wlock: user *, process * (*s) (glob)
488 488 [1]
489 489
490 490 $ hg debuglocks -W
491 491
492 492 $ hg debuglocks
493 493 lock: free
494 494 wlock: free
495 495
496 496 $ touch .hg/unlock
497 497 $ wait
498 498
499 499 Test WdirUnsupported exception
500 500
501 501 $ hg debugdata -c ffffffffffffffffffffffffffffffffffffffff
502 502 abort: working directory revision cannot be specified
503 503 [255]
504 504
505 505 Test cache warming command
506 506
507 507 $ rm -rf .hg/cache/
508 508 $ hg debugupdatecaches --debug
509 509 updating the branch cache
510 510 $ ls -r .hg/cache/*
511 511 .hg/cache/rbc-revs-v1
512 512 .hg/cache/rbc-names-v1
513 .hg/cache/manifestfulltextcache
513 .hg/cache/manifestfulltextcache (reporevlogstore !)
514 514 .hg/cache/branch2-served
515 515
516 516 Test debugcolor
517 517
518 518 #if no-windows
519 519 $ hg debugcolor --style --color always | egrep 'mode|style|log\.'
520 520 color mode: 'ansi'
521 521 available style:
522 522 \x1b[0;33mlog.changeset\x1b[0m: \x1b[0;33myellow\x1b[0m (esc)
523 523 #endif
524 524
525 525 $ hg debugcolor --style --color never
526 526 color mode: None
527 527 available style:
528 528
529 529 $ cd ..
530 530
531 531 Test internal debugstacktrace command
532 532
533 533 $ cat > debugstacktrace.py << EOF
534 534 > from __future__ import absolute_import
535 535 > import sys
536 536 > from mercurial import util
537 537 > def f():
538 538 > util.debugstacktrace(f=sys.stdout)
539 539 > g()
540 540 > def g():
541 541 > util.dst('hello from g\\n', skip=1)
542 542 > h()
543 543 > def h():
544 544 > util.dst('hi ...\\nfrom h hidden in g', 1, depth=2)
545 545 > f()
546 546 > EOF
547 547 $ $PYTHON debugstacktrace.py
548 548 stacktrace at:
549 549 debugstacktrace.py:12 in * (glob)
550 550 debugstacktrace.py:5 in f
551 551 hello from g at:
552 552 debugstacktrace.py:12 in * (glob)
553 553 debugstacktrace.py:6 in f
554 554 hi ...
555 555 from h hidden in g at:
556 556 debugstacktrace.py:6 in f
557 557 debugstacktrace.py:9 in g
558 558
559 559 Test debugcapabilities command:
560 560
561 561 $ hg debugcapabilities ./debugrevlog/
562 562 Main capabilities:
563 563 branchmap
564 564 $USUAL_BUNDLE2_CAPS$
565 565 getbundle
566 566 known
567 567 lookup
568 568 pushkey
569 569 unbundle
570 570 Bundle2 capabilities:
571 571 HG20
572 572 bookmarks
573 573 changegroup
574 574 01
575 575 02
576 576 digests
577 577 md5
578 578 sha1
579 579 sha512
580 580 error
581 581 abort
582 582 unsupportedcontent
583 583 pushraced
584 584 pushkey
585 585 hgtagsfnodes
586 586 listkeys
587 587 phases
588 588 heads
589 589 pushkey
590 590 remote-changegroup
591 591 http
592 592 https
593 593 rev-branch-cache
594 594 stream
595 595 v2
596 596
597 597 Test debugpeer
598 598
599 599 $ hg --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" debugpeer ssh://user@dummy/debugrevlog
600 600 url: ssh://user@dummy/debugrevlog
601 601 local: no
602 602 pushable: yes
603 603
604 604 $ hg --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" --debug debugpeer ssh://user@dummy/debugrevlog
605 605 running "*" "*/tests/dummyssh" 'user@dummy' 'hg -R debugrevlog serve --stdio' (glob) (no-windows !)
606 606 running "*" "*\tests/dummyssh" "user@dummy" "hg -R debugrevlog serve --stdio" (glob) (windows !)
607 607 devel-peer-request: hello+between
608 608 devel-peer-request: pairs: 81 bytes
609 609 sending hello command
610 610 sending between command
611 611 remote: 413
612 612 remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
613 613 remote: 1
614 614 devel-peer-request: protocaps
615 615 devel-peer-request: caps: * bytes (glob)
616 616 sending protocaps command
617 617 url: ssh://user@dummy/debugrevlog
618 618 local: no
619 619 pushable: yes
@@ -1,510 +1,510 b''
1 1 #require repofncache
2 2
3 3 Init repo1:
4 4
5 5 $ hg init repo1
6 6 $ cd repo1
7 7 $ echo "some text" > a
8 8 $ hg add
9 9 adding a
10 10 $ hg ci -m first
11 11 $ cat .hg/store/fncache | sort
12 12 data/a.i
13 13
14 14 Testing a.i/b:
15 15
16 16 $ mkdir a.i
17 17 $ echo "some other text" > a.i/b
18 18 $ hg add
19 19 adding a.i/b
20 20 $ hg ci -m second
21 21 $ cat .hg/store/fncache | sort
22 22 data/a.i
23 23 data/a.i.hg/b.i
24 24
25 25 Testing a.i.hg/c:
26 26
27 27 $ mkdir a.i.hg
28 28 $ echo "yet another text" > a.i.hg/c
29 29 $ hg add
30 30 adding a.i.hg/c
31 31 $ hg ci -m third
32 32 $ cat .hg/store/fncache | sort
33 33 data/a.i
34 34 data/a.i.hg.hg/c.i
35 35 data/a.i.hg/b.i
36 36
37 37 Testing verify:
38 38
39 39 $ hg verify
40 40 checking changesets
41 41 checking manifests
42 42 crosschecking files in changesets and manifests
43 43 checking files
44 44 3 files, 3 changesets, 3 total revisions
45 45
46 46 $ rm .hg/store/fncache
47 47
48 48 $ hg verify
49 49 checking changesets
50 50 checking manifests
51 51 crosschecking files in changesets and manifests
52 52 checking files
53 53 warning: revlog 'data/a.i' not in fncache!
54 54 warning: revlog 'data/a.i.hg/c.i' not in fncache!
55 55 warning: revlog 'data/a.i/b.i' not in fncache!
56 56 3 files, 3 changesets, 3 total revisions
57 57 3 warnings encountered!
58 58 hint: run "hg debugrebuildfncache" to recover from corrupt fncache
59 59
60 60 Follow the hint to make sure it works
61 61
62 62 $ hg debugrebuildfncache
63 63 adding data/a.i
64 64 adding data/a.i.hg/c.i
65 65 adding data/a.i/b.i
66 66 3 items added, 0 removed from fncache
67 67
68 68 $ hg verify
69 69 checking changesets
70 70 checking manifests
71 71 crosschecking files in changesets and manifests
72 72 checking files
73 73 3 files, 3 changesets, 3 total revisions
74 74
75 75 $ cd ..
76 76
77 77 Non store repo:
78 78
79 79 $ hg --config format.usestore=False init foo
80 80 $ cd foo
81 81 $ mkdir tst.d
82 82 $ echo foo > tst.d/foo
83 83 $ hg ci -Amfoo
84 84 adding tst.d/foo
85 85 $ find .hg | sort
86 86 .hg
87 87 .hg/00changelog.i
88 88 .hg/00manifest.i
89 89 .hg/cache
90 90 .hg/cache/branch2-served
91 .hg/cache/manifestfulltextcache
91 .hg/cache/manifestfulltextcache (reporevlogstore !)
92 92 .hg/cache/rbc-names-v1
93 93 .hg/cache/rbc-revs-v1
94 94 .hg/data
95 95 .hg/data/tst.d.hg
96 96 .hg/data/tst.d.hg/foo.i
97 97 .hg/dirstate
98 98 .hg/fsmonitor.state (fsmonitor !)
99 99 .hg/last-message.txt
100 100 .hg/phaseroots
101 101 .hg/requires
102 102 .hg/undo
103 103 .hg/undo.backup.dirstate
104 104 .hg/undo.backupfiles
105 105 .hg/undo.bookmarks
106 106 .hg/undo.branch
107 107 .hg/undo.desc
108 108 .hg/undo.dirstate
109 109 .hg/undo.phaseroots
110 110 $ cd ..
111 111
112 112 Non fncache repo:
113 113
114 114 $ hg --config format.usefncache=False init bar
115 115 $ cd bar
116 116 $ mkdir tst.d
117 117 $ echo foo > tst.d/Foo
118 118 $ hg ci -Amfoo
119 119 adding tst.d/Foo
120 120 $ find .hg | sort
121 121 .hg
122 122 .hg/00changelog.i
123 123 .hg/cache
124 124 .hg/cache/branch2-served
125 .hg/cache/manifestfulltextcache
125 .hg/cache/manifestfulltextcache (reporevlogstore !)
126 126 .hg/cache/rbc-names-v1
127 127 .hg/cache/rbc-revs-v1
128 128 .hg/dirstate
129 129 .hg/fsmonitor.state (fsmonitor !)
130 130 .hg/last-message.txt
131 131 .hg/requires
132 132 .hg/store
133 133 .hg/store/00changelog.i
134 134 .hg/store/00manifest.i
135 135 .hg/store/data
136 136 .hg/store/data/tst.d.hg
137 137 .hg/store/data/tst.d.hg/_foo.i
138 138 .hg/store/phaseroots
139 139 .hg/store/undo
140 140 .hg/store/undo.backupfiles
141 141 .hg/store/undo.phaseroots
142 142 .hg/undo.backup.dirstate
143 143 .hg/undo.bookmarks
144 144 .hg/undo.branch
145 145 .hg/undo.desc
146 146 .hg/undo.dirstate
147 147 $ cd ..
148 148
149 149 Encoding of reserved / long paths in the store
150 150
151 151 $ hg init r2
152 152 $ cd r2
153 153 $ cat <<EOF > .hg/hgrc
154 154 > [ui]
155 155 > portablefilenames = ignore
156 156 > EOF
157 157
158 158 $ hg import -q --bypass - <<EOF
159 159 > # HG changeset patch
160 160 > # User test
161 161 > # Date 0 0
162 162 > # Node ID 1c7a2f7cb77be1a0def34e4c7cabc562ad98fbd7
163 163 > # Parent 0000000000000000000000000000000000000000
164 164 > 1
165 165 >
166 166 > diff --git a/12345678/12345678/12345678/12345678/12345678/12345678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3456789-12345-ABCDEFGHIJKLMNOPRSTUVWXYZ-abcdefghjiklmnopqrstuvwxyz b/12345678/12345678/12345678/12345678/12345678/12345678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3456789-12345-ABCDEFGHIJKLMNOPRSTUVWXYZ-abcdefghjiklmnopqrstuvwxyz
167 167 > new file mode 100644
168 168 > --- /dev/null
169 169 > +++ b/12345678/12345678/12345678/12345678/12345678/12345678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3456789-12345-ABCDEFGHIJKLMNOPRSTUVWXYZ-abcdefghjiklmnopqrstuvwxyz
170 170 > @@ -0,0 +1,1 @@
171 171 > +foo
172 172 > diff --git a/AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH/TENTH/ELEVENTH/LOREMIPSUM.TXT b/AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH/TENTH/ELEVENTH/LOREMIPSUM.TXT
173 173 > new file mode 100644
174 174 > --- /dev/null
175 175 > +++ b/AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH/TENTH/ELEVENTH/LOREMIPSUM.TXT
176 176 > @@ -0,0 +1,1 @@
177 177 > +foo
178 178 > diff --git a/Project Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt b/Project Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt
179 179 > new file mode 100644
180 180 > --- /dev/null
181 181 > +++ b/Project Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt
182 182 > @@ -0,0 +1,1 @@
183 183 > +foo
184 184 > diff --git a/bla.aux/prn/PRN/lpt/com3/nul/coma/foo.NUL/normal.c b/bla.aux/prn/PRN/lpt/com3/nul/coma/foo.NUL/normal.c
185 185 > new file mode 100644
186 186 > --- /dev/null
187 187 > +++ b/bla.aux/prn/PRN/lpt/com3/nul/coma/foo.NUL/normal.c
188 188 > @@ -0,0 +1,1 @@
189 189 > +foo
190 190 > diff --git a/enterprise/openesbaddons/contrib-imola/corba-bc/netbeansplugin/wsdlExtension/src/main/java/META-INF/services/org.netbeans.modules.xml.wsdl.bindingsupport.spi.ExtensibilityElementTemplateProvider b/enterprise/openesbaddons/contrib-imola/corba-bc/netbeansplugin/wsdlExtension/src/main/java/META-INF/services/org.netbeans.modules.xml.wsdl.bindingsupport.spi.ExtensibilityElementTemplateProvider
191 191 > new file mode 100644
192 192 > --- /dev/null
193 193 > +++ b/enterprise/openesbaddons/contrib-imola/corba-bc/netbeansplugin/wsdlExtension/src/main/java/META-INF/services/org.netbeans.modules.xml.wsdl.bindingsupport.spi.ExtensibilityElementTemplateProvider
194 194 > @@ -0,0 +1,1 @@
195 195 > +foo
196 196 > EOF
197 197
198 198 $ find .hg/store -name *.i | sort
199 199 .hg/store/00changelog.i
200 200 .hg/store/00manifest.i
201 201 .hg/store/data/bla.aux/pr~6e/_p_r_n/lpt/co~6d3/nu~6c/coma/foo._n_u_l/normal.c.i
202 202 .hg/store/dh/12345678/12345678/12345678/12345678/12345678/12345678/12345678/12345/xxxxxx168e07b38e65eff86ab579afaaa8e30bfbe0f35f.i
203 203 .hg/store/dh/au~78/second/x.prn/fourth/fi~3afth/sixth/seventh/eighth/nineth/tenth/loremia20419e358ddff1bf8751e38288aff1d7c32ec05.i
204 204 .hg/store/dh/enterpri/openesba/contrib-/corba-bc/netbeans/wsdlexte/src/main/java/org.net7018f27961fdf338a598a40c4683429e7ffb9743.i
205 205 .hg/store/dh/project_/resource/anotherl/followed/andanoth/andthenanextremelylongfilename0d8e1f4187c650e2f1fdca9fd90f786bc0976b6b.i
206 206
207 207 $ cd ..
208 208
209 209 Aborting lock does not prevent fncache writes
210 210
211 211 $ cat > exceptionext.py <<EOF
212 212 > from __future__ import absolute_import
213 213 > import os
214 214 > from mercurial import commands, error, extensions
215 215 >
216 216 > def lockexception(orig, vfs, lockname, wait, releasefn, *args, **kwargs):
217 217 > def releasewrap():
218 218 > l.held = False # ensure __del__ is a noop
219 219 > raise error.Abort("forced lock failure")
220 220 > l = orig(vfs, lockname, wait, releasewrap, *args, **kwargs)
221 221 > return l
222 222 >
223 223 > def reposetup(ui, repo):
224 224 > extensions.wrapfunction(repo, '_lock', lockexception)
225 225 >
226 226 > cmdtable = {}
227 227 >
228 228 > # wrap "commit" command to prevent wlock from being '__del__()'-ed
229 229 > # at the end of dispatching (for intentional "forced lcok failure")
230 230 > def commitwrap(orig, ui, repo, *pats, **opts):
231 231 > repo = repo.unfiltered() # to use replaced repo._lock certainly
232 232 > wlock = repo.wlock()
233 233 > try:
234 234 > return orig(ui, repo, *pats, **opts)
235 235 > finally:
236 236 > # multiple 'relase()' is needed for complete releasing wlock,
237 237 > # because "forced" abort at last releasing store lock
238 238 > # prevents wlock from being released at same 'lockmod.release()'
239 239 > for i in range(wlock.held):
240 240 > wlock.release()
241 241 >
242 242 > def extsetup(ui):
243 243 > extensions.wrapcommand(commands.table, b"commit", commitwrap)
244 244 > EOF
245 245 $ extpath=`pwd`/exceptionext.py
246 246 $ hg init fncachetxn
247 247 $ cd fncachetxn
248 248 $ printf "[extensions]\nexceptionext=$extpath\n" >> .hg/hgrc
249 249 $ touch y
250 250 $ hg ci -qAm y
251 251 abort: forced lock failure
252 252 [255]
253 253 $ cat .hg/store/fncache
254 254 data/y.i
255 255
256 256 Aborting transaction prevents fncache change
257 257
258 258 $ cat > ../exceptionext.py <<EOF
259 259 > from __future__ import absolute_import
260 260 > import os
261 261 > from mercurial import commands, error, extensions, localrepo
262 262 >
263 263 > def wrapper(orig, self, *args, **kwargs):
264 264 > tr = orig(self, *args, **kwargs)
265 265 > def fail(tr):
266 266 > raise error.Abort(b"forced transaction failure")
267 267 > # zzz prefix to ensure it sorted after store.write
268 268 > tr.addfinalize(b'zzz-forcefails', fail)
269 269 > return tr
270 270 >
271 271 > def uisetup(ui):
272 272 > extensions.wrapfunction(
273 273 > localrepo.localrepository, b'transaction', wrapper)
274 274 >
275 275 > cmdtable = {}
276 276 >
277 277 > EOF
278 278
279 279 Clean cached version
280 280 $ rm -f "${extpath}c"
281 281 $ rm -Rf "`dirname $extpath`/__pycache__"
282 282
283 283 $ touch z
284 284 $ hg ci -qAm z
285 285 transaction abort!
286 286 rollback completed
287 287 abort: forced transaction failure
288 288 [255]
289 289 $ cat .hg/store/fncache
290 290 data/y.i
291 291
292 292 Aborted transactions can be recovered later
293 293
294 294 $ cat > ../exceptionext.py <<EOF
295 295 > from __future__ import absolute_import
296 296 > import os
297 297 > from mercurial import (
298 298 > commands,
299 299 > error,
300 300 > extensions,
301 301 > localrepo,
302 302 > transaction,
303 303 > )
304 304 >
305 305 > def trwrapper(orig, self, *args, **kwargs):
306 306 > tr = orig(self, *args, **kwargs)
307 307 > def fail(tr):
308 308 > raise error.Abort("forced transaction failure")
309 309 > # zzz prefix to ensure it sorted after store.write
310 310 > tr.addfinalize('zzz-forcefails', fail)
311 311 > return tr
312 312 >
313 313 > def abortwrapper(orig, self, *args, **kwargs):
314 314 > raise error.Abort("forced transaction failure")
315 315 >
316 316 > def uisetup(ui):
317 317 > extensions.wrapfunction(localrepo.localrepository, 'transaction',
318 318 > trwrapper)
319 319 > extensions.wrapfunction(transaction.transaction, '_abort',
320 320 > abortwrapper)
321 321 >
322 322 > cmdtable = {}
323 323 >
324 324 > EOF
325 325
326 326 Clean cached versions
327 327 $ rm -f "${extpath}c"
328 328 $ rm -Rf "`dirname $extpath`/__pycache__"
329 329
330 330 $ hg up -q 1
331 331 $ touch z
332 332 $ hg ci -qAm z 2>/dev/null
333 333 [255]
334 334 $ cat .hg/store/fncache | sort
335 335 data/y.i
336 336 data/z.i
337 337 $ hg recover
338 338 rolling back interrupted transaction
339 339 checking changesets
340 340 checking manifests
341 341 crosschecking files in changesets and manifests
342 342 checking files
343 343 1 files, 1 changesets, 1 total revisions
344 344 $ cat .hg/store/fncache
345 345 data/y.i
346 346
347 347 $ cd ..
348 348
349 349 debugrebuildfncache does nothing unless repo has fncache requirement
350 350
351 351 $ hg --config format.usefncache=false init nofncache
352 352 $ cd nofncache
353 353 $ hg debugrebuildfncache
354 354 (not rebuilding fncache because repository does not support fncache)
355 355
356 356 $ cd ..
357 357
358 358 debugrebuildfncache works on empty repository
359 359
360 360 $ hg init empty
361 361 $ cd empty
362 362 $ hg debugrebuildfncache
363 363 fncache already up to date
364 364 $ cd ..
365 365
366 366 debugrebuildfncache on an up to date repository no-ops
367 367
368 368 $ hg init repo
369 369 $ cd repo
370 370 $ echo initial > foo
371 371 $ echo initial > .bar
372 372 $ hg commit -A -m initial
373 373 adding .bar
374 374 adding foo
375 375
376 376 $ cat .hg/store/fncache | sort
377 377 data/.bar.i
378 378 data/foo.i
379 379
380 380 $ hg debugrebuildfncache
381 381 fncache already up to date
382 382
383 383 debugrebuildfncache restores deleted fncache file
384 384
385 385 $ rm -f .hg/store/fncache
386 386 $ hg debugrebuildfncache
387 387 adding data/.bar.i
388 388 adding data/foo.i
389 389 2 items added, 0 removed from fncache
390 390
391 391 $ cat .hg/store/fncache | sort
392 392 data/.bar.i
393 393 data/foo.i
394 394
395 395 Rebuild after rebuild should no-op
396 396
397 397 $ hg debugrebuildfncache
398 398 fncache already up to date
399 399
400 400 A single missing file should get restored, an extra file should be removed
401 401
402 402 $ cat > .hg/store/fncache << EOF
403 403 > data/foo.i
404 404 > data/bad-entry.i
405 405 > EOF
406 406
407 407 $ hg debugrebuildfncache
408 408 removing data/bad-entry.i
409 409 adding data/.bar.i
410 410 1 items added, 1 removed from fncache
411 411
412 412 $ cat .hg/store/fncache | sort
413 413 data/.bar.i
414 414 data/foo.i
415 415
416 416 $ cd ..
417 417
418 418 Try a simple variation without dotencode to ensure fncache is ignorant of encoding
419 419
420 420 $ hg --config format.dotencode=false init nodotencode
421 421 $ cd nodotencode
422 422 $ echo initial > foo
423 423 $ echo initial > .bar
424 424 $ hg commit -A -m initial
425 425 adding .bar
426 426 adding foo
427 427
428 428 $ cat .hg/store/fncache | sort
429 429 data/.bar.i
430 430 data/foo.i
431 431
432 432 $ rm .hg/store/fncache
433 433 $ hg debugrebuildfncache
434 434 adding data/.bar.i
435 435 adding data/foo.i
436 436 2 items added, 0 removed from fncache
437 437
438 438 $ cat .hg/store/fncache | sort
439 439 data/.bar.i
440 440 data/foo.i
441 441
442 442 $ cd ..
443 443
444 444 In repositories that have accumulated a large number of files over time, the
445 445 fncache file is going to be large. If we possibly can avoid loading it, so much the better.
446 446 The cache should not loaded when committing changes to existing files, or when unbundling
447 447 changesets that only contain changes to existing files:
448 448
449 449 $ cat > fncacheloadwarn.py << EOF
450 450 > from __future__ import absolute_import
451 451 > from mercurial import extensions, store
452 452 >
453 453 > def extsetup(ui):
454 454 > def wrapstore(orig, requirements, *args):
455 455 > store = orig(requirements, *args)
456 456 > if 'store' in requirements and 'fncache' in requirements:
457 457 > instrumentfncachestore(store, ui)
458 458 > return store
459 459 > extensions.wrapfunction(store, 'store', wrapstore)
460 460 >
461 461 > def instrumentfncachestore(fncachestore, ui):
462 462 > class instrumentedfncache(type(fncachestore.fncache)):
463 463 > def _load(self):
464 464 > ui.warn('fncache load triggered!\n')
465 465 > super(instrumentedfncache, self)._load()
466 466 > fncachestore.fncache.__class__ = instrumentedfncache
467 467 > EOF
468 468
469 469 $ fncachextpath=`pwd`/fncacheloadwarn.py
470 470 $ hg init nofncacheload
471 471 $ cd nofncacheload
472 472 $ printf "[extensions]\nfncacheloadwarn=$fncachextpath\n" >> .hg/hgrc
473 473
474 474 A new file should trigger a load, as we'd want to update the fncache set in that case:
475 475
476 476 $ touch foo
477 477 $ hg ci -qAm foo
478 478 fncache load triggered!
479 479
480 480 But modifying that file should not:
481 481
482 482 $ echo bar >> foo
483 483 $ hg ci -qm foo
484 484
485 485 If a transaction has been aborted, the zero-size truncated index file will
486 486 not prevent the fncache from being loaded; rather than actually abort
487 487 a transaction, we simulate the situation by creating a zero-size index file:
488 488
489 489 $ touch .hg/store/data/bar.i
490 490 $ touch bar
491 491 $ hg ci -qAm bar
492 492 fncache load triggered!
493 493
494 494 Unbundling should follow the same rules; existing files should not cause a load:
495 495
496 496 $ hg clone -q . tobundle
497 497 $ echo 'new line' > tobundle/bar
498 498 $ hg -R tobundle ci -qm bar
499 499 $ hg -R tobundle bundle -q barupdated.hg
500 500 $ hg unbundle -q barupdated.hg
501 501
502 502 but adding new files should:
503 503
504 504 $ touch tobundle/newfile
505 505 $ hg -R tobundle ci -qAm newfile
506 506 $ hg -R tobundle bundle -q newfile.hg
507 507 $ hg unbundle -q newfile.hg
508 508 fncache load triggered!
509 509
510 510 $ cd ..
@@ -1,431 +1,431 b''
1 1 #require hardlink reporevlogstore
2 2
3 3 $ cat > nlinks.py <<EOF
4 4 > from __future__ import print_function
5 5 > import sys
6 6 > from mercurial import util
7 7 > for f in sorted(sys.stdin.readlines()):
8 8 > f = f[:-1]
9 9 > print(util.nlinks(f), f)
10 10 > EOF
11 11
12 12 $ nlinksdir()
13 13 > {
14 14 > find "$@" -type f | $PYTHON $TESTTMP/nlinks.py
15 15 > }
16 16
17 17 Some implementations of cp can't create hardlinks (replaces 'cp -al' on Linux):
18 18
19 19 $ cat > linkcp.py <<EOF
20 20 > from __future__ import absolute_import
21 21 > import sys
22 22 > from mercurial import util
23 23 > util.copyfiles(sys.argv[1], sys.argv[2], hardlink=True)
24 24 > EOF
25 25
26 26 $ linkcp()
27 27 > {
28 28 > $PYTHON $TESTTMP/linkcp.py $1 $2
29 29 > }
30 30
31 31 Prepare repo r1:
32 32
33 33 $ hg init r1
34 34 $ cd r1
35 35
36 36 $ echo c1 > f1
37 37 $ hg add f1
38 38 $ hg ci -m0
39 39
40 40 $ mkdir d1
41 41 $ cd d1
42 42 $ echo c2 > f2
43 43 $ hg add f2
44 44 $ hg ci -m1
45 45 $ cd ../..
46 46
47 47 $ nlinksdir r1/.hg/store
48 48 1 r1/.hg/store/00changelog.i
49 49 1 r1/.hg/store/00manifest.i
50 50 1 r1/.hg/store/data/d1/f2.i
51 51 1 r1/.hg/store/data/f1.i
52 52 1 r1/.hg/store/fncache (repofncache !)
53 53 1 r1/.hg/store/phaseroots
54 54 1 r1/.hg/store/undo
55 55 1 r1/.hg/store/undo.backup.fncache (repofncache !)
56 56 1 r1/.hg/store/undo.backupfiles
57 57 1 r1/.hg/store/undo.phaseroots
58 58
59 59
60 60 Create hardlinked clone r2:
61 61
62 62 $ hg clone -U --debug r1 r2 --config progress.debug=true
63 63 linking: 1
64 64 linking: 2
65 65 linking: 3
66 66 linking: 4
67 67 linking: 5
68 68 linking: 6
69 69 linking: 7
70 70 linked 7 files
71 71
72 72 Create non-hardlinked clone r3:
73 73
74 74 $ hg clone --pull r1 r3
75 75 requesting all changes
76 76 adding changesets
77 77 adding manifests
78 78 adding file changes
79 79 added 2 changesets with 2 changes to 2 files
80 80 new changesets 40d85e9847f2:7069c422939c
81 81 updating to branch default
82 82 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
83 83
84 84
85 85 Repos r1 and r2 should now contain hardlinked files:
86 86
87 87 $ nlinksdir r1/.hg/store
88 88 2 r1/.hg/store/00changelog.i
89 89 2 r1/.hg/store/00manifest.i
90 90 2 r1/.hg/store/data/d1/f2.i
91 91 2 r1/.hg/store/data/f1.i
92 92 2 r1/.hg/store/fncache (repofncache !)
93 93 1 r1/.hg/store/phaseroots
94 94 1 r1/.hg/store/undo
95 95 1 r1/.hg/store/undo.backup.fncache (repofncache !)
96 96 1 r1/.hg/store/undo.backupfiles
97 97 1 r1/.hg/store/undo.phaseroots
98 98
99 99 $ nlinksdir r2/.hg/store
100 100 2 r2/.hg/store/00changelog.i
101 101 2 r2/.hg/store/00manifest.i
102 102 2 r2/.hg/store/data/d1/f2.i
103 103 2 r2/.hg/store/data/f1.i
104 104 2 r2/.hg/store/fncache (repofncache !)
105 105
106 106 Repo r3 should not be hardlinked:
107 107
108 108 $ nlinksdir r3/.hg/store
109 109 1 r3/.hg/store/00changelog.i
110 110 1 r3/.hg/store/00manifest.i
111 111 1 r3/.hg/store/data/d1/f2.i
112 112 1 r3/.hg/store/data/f1.i
113 113 1 r3/.hg/store/fncache (repofncache !)
114 114 1 r3/.hg/store/phaseroots
115 115 1 r3/.hg/store/undo
116 116 1 r3/.hg/store/undo.backupfiles
117 117 1 r3/.hg/store/undo.phaseroots
118 118
119 119
120 120 Create a non-inlined filelog in r3:
121 121
122 122 $ cd r3/d1
123 123 >>> f = open('data1', 'wb')
124 124 >>> for x in range(10000):
125 125 ... f.write(b"%d\n" % x) and None
126 126 >>> f.close()
127 127 $ for j in 0 1 2 3 4 5 6 7 8 9; do
128 128 > cat data1 >> f2
129 129 > hg commit -m$j
130 130 > done
131 131 $ cd ../..
132 132
133 133 $ nlinksdir r3/.hg/store
134 134 1 r3/.hg/store/00changelog.i
135 135 1 r3/.hg/store/00manifest.i
136 136 1 r3/.hg/store/data/d1/f2.d
137 137 1 r3/.hg/store/data/d1/f2.i
138 138 1 r3/.hg/store/data/f1.i
139 139 1 r3/.hg/store/fncache (repofncache !)
140 140 1 r3/.hg/store/phaseroots
141 141 1 r3/.hg/store/undo
142 142 1 r3/.hg/store/undo.backup.fncache (repofncache !)
143 143 1 r3/.hg/store/undo.backup.phaseroots
144 144 1 r3/.hg/store/undo.backupfiles
145 145 1 r3/.hg/store/undo.phaseroots
146 146
147 147 Push to repo r1 should break up most hardlinks in r2:
148 148
149 149 $ hg -R r2 verify
150 150 checking changesets
151 151 checking manifests
152 152 crosschecking files in changesets and manifests
153 153 checking files
154 154 2 files, 2 changesets, 2 total revisions
155 155
156 156 $ cd r3
157 157 $ hg push
158 158 pushing to $TESTTMP/r1
159 159 searching for changes
160 160 adding changesets
161 161 adding manifests
162 162 adding file changes
163 163 added 10 changesets with 10 changes to 1 files
164 164
165 165 $ cd ..
166 166
167 167 $ nlinksdir r2/.hg/store
168 168 1 r2/.hg/store/00changelog.i
169 169 1 r2/.hg/store/00manifest.i
170 170 1 r2/.hg/store/data/d1/f2.i
171 171 2 r2/.hg/store/data/f1.i
172 172 [12] r2/\.hg/store/fncache (re) (repofncache !)
173 173
174 174 #if hardlink-whitelisted repofncache
175 175 $ nlinksdir r2/.hg/store/fncache
176 176 2 r2/.hg/store/fncache
177 177 #endif
178 178
179 179 $ hg -R r2 verify
180 180 checking changesets
181 181 checking manifests
182 182 crosschecking files in changesets and manifests
183 183 checking files
184 184 2 files, 2 changesets, 2 total revisions
185 185
186 186
187 187 $ cd r1
188 188 $ hg up
189 189 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
190 190
191 191 Committing a change to f1 in r1 must break up hardlink f1.i in r2:
192 192
193 193 $ echo c1c1 >> f1
194 194 $ hg ci -m00
195 195 $ cd ..
196 196
197 197 $ nlinksdir r2/.hg/store
198 198 1 r2/.hg/store/00changelog.i
199 199 1 r2/.hg/store/00manifest.i
200 200 1 r2/.hg/store/data/d1/f2.i
201 201 1 r2/.hg/store/data/f1.i
202 202 [12] r2/\.hg/store/fncache (re) (repofncache !)
203 203
204 204 #if hardlink-whitelisted repofncache
205 205 $ nlinksdir r2/.hg/store/fncache
206 206 2 r2/.hg/store/fncache
207 207 #endif
208 208
209 209 Create a file which exec permissions we will change
210 210 $ cd r3
211 211 $ echo "echo hello world" > f3
212 212 $ hg add f3
213 213 $ hg ci -mf3
214 214 $ cd ..
215 215
216 216 $ cd r3
217 217 $ hg tip --template '{rev}:{node|short}\n'
218 218 12:d3b77733a28a
219 219 $ echo bla > f1
220 220 $ chmod +x f3
221 221 $ hg ci -m1
222 222 $ cd ..
223 223
224 224 Create hardlinked copy r4 of r3 (on Linux, we would call 'cp -al'):
225 225
226 226 $ linkcp r3 r4
227 227
228 228 'checklink' is produced by hardlinking a symlink, which is undefined whether
229 229 the symlink should be followed or not. It does behave differently on Linux and
230 230 BSD. Just remove it so the test pass on both platforms.
231 231
232 232 $ rm -f r4/.hg/cache/checklink
233 233
234 234 r4 has hardlinks in the working dir (not just inside .hg):
235 235
236 236 $ nlinksdir r4
237 237 2 r4/.hg/00changelog.i
238 238 2 r4/.hg/branch
239 239 2 r4/.hg/cache/branch2-base
240 240 2 r4/.hg/cache/branch2-served
241 241 2 r4/.hg/cache/checkisexec (execbit !)
242 242 ? r4/.hg/cache/checklink-target (glob) (symlink !)
243 243 2 r4/.hg/cache/checknoexec (execbit !)
244 2 r4/.hg/cache/manifestfulltextcache
244 2 r4/.hg/cache/manifestfulltextcache (reporevlogstore !)
245 245 2 r4/.hg/cache/rbc-names-v1
246 246 2 r4/.hg/cache/rbc-revs-v1
247 247 2 r4/.hg/dirstate
248 248 2 r4/.hg/fsmonitor.state (fsmonitor !)
249 249 2 r4/.hg/hgrc
250 250 2 r4/.hg/last-message.txt
251 251 2 r4/.hg/requires
252 252 2 r4/.hg/store/00changelog.i
253 253 2 r4/.hg/store/00manifest.i
254 254 2 r4/.hg/store/data/d1/f2.d
255 255 2 r4/.hg/store/data/d1/f2.i
256 256 2 r4/.hg/store/data/f1.i
257 257 2 r4/.hg/store/data/f3.i
258 258 2 r4/.hg/store/fncache (repofncache !)
259 259 2 r4/.hg/store/phaseroots
260 260 2 r4/.hg/store/undo
261 261 2 r4/.hg/store/undo.backup.fncache (repofncache !)
262 262 2 r4/.hg/store/undo.backup.phaseroots
263 263 2 r4/.hg/store/undo.backupfiles
264 264 2 r4/.hg/store/undo.phaseroots
265 265 [24] r4/\.hg/undo\.backup\.dirstate (re)
266 266 2 r4/.hg/undo.bookmarks
267 267 2 r4/.hg/undo.branch
268 268 2 r4/.hg/undo.desc
269 269 [24] r4/\.hg/undo\.dirstate (re)
270 270 2 r4/d1/data1
271 271 2 r4/d1/f2
272 272 2 r4/f1
273 273 2 r4/f3
274 274
275 275 Update back to revision 12 in r4 should break hardlink of file f1 and f3:
276 276 #if hardlink-whitelisted
277 277 $ nlinksdir r4/.hg/undo.backup.dirstate r4/.hg/undo.dirstate
278 278 4 r4/.hg/undo.backup.dirstate
279 279 4 r4/.hg/undo.dirstate
280 280 #endif
281 281
282 282
283 283 $ hg -R r4 up 12
284 284 2 files updated, 0 files merged, 0 files removed, 0 files unresolved (execbit !)
285 285 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (no-execbit !)
286 286
287 287 $ nlinksdir r4
288 288 2 r4/.hg/00changelog.i
289 289 1 r4/.hg/branch
290 290 2 r4/.hg/cache/branch2-base
291 291 2 r4/.hg/cache/branch2-served
292 292 2 r4/.hg/cache/checkisexec (execbit !)
293 293 2 r4/.hg/cache/checklink-target (symlink !)
294 294 2 r4/.hg/cache/checknoexec (execbit !)
295 2 r4/.hg/cache/manifestfulltextcache
295 2 r4/.hg/cache/manifestfulltextcache (reporevlogstore !)
296 296 2 r4/.hg/cache/rbc-names-v1
297 297 2 r4/.hg/cache/rbc-revs-v1
298 298 1 r4/.hg/dirstate
299 299 1 r4/.hg/fsmonitor.state (fsmonitor !)
300 300 2 r4/.hg/hgrc
301 301 2 r4/.hg/last-message.txt
302 302 2 r4/.hg/requires
303 303 2 r4/.hg/store/00changelog.i
304 304 2 r4/.hg/store/00manifest.i
305 305 2 r4/.hg/store/data/d1/f2.d
306 306 2 r4/.hg/store/data/d1/f2.i
307 307 2 r4/.hg/store/data/f1.i
308 308 2 r4/.hg/store/data/f3.i
309 309 2 r4/.hg/store/fncache
310 310 2 r4/.hg/store/phaseroots
311 311 2 r4/.hg/store/undo
312 312 2 r4/.hg/store/undo.backup.fncache (repofncache !)
313 313 2 r4/.hg/store/undo.backup.phaseroots
314 314 2 r4/.hg/store/undo.backupfiles
315 315 2 r4/.hg/store/undo.phaseroots
316 316 [24] r4/\.hg/undo\.backup\.dirstate (re)
317 317 2 r4/.hg/undo.bookmarks
318 318 2 r4/.hg/undo.branch
319 319 2 r4/.hg/undo.desc
320 320 [24] r4/\.hg/undo\.dirstate (re)
321 321 2 r4/d1/data1
322 322 2 r4/d1/f2
323 323 1 r4/f1
324 324 1 r4/f3 (execbit !)
325 325 2 r4/f3 (no-execbit !)
326 326
327 327 #if hardlink-whitelisted
328 328 $ nlinksdir r4/.hg/undo.backup.dirstate r4/.hg/undo.dirstate
329 329 4 r4/.hg/undo.backup.dirstate
330 330 4 r4/.hg/undo.dirstate
331 331 #endif
332 332
333 333 Test hardlinking outside hg:
334 334
335 335 $ mkdir x
336 336 $ echo foo > x/a
337 337
338 338 $ linkcp x y
339 339 $ echo bar >> y/a
340 340
341 341 No diff if hardlink:
342 342
343 343 $ diff x/a y/a
344 344
345 345 Test mq hardlinking:
346 346
347 347 $ echo "[extensions]" >> $HGRCPATH
348 348 $ echo "mq=" >> $HGRCPATH
349 349
350 350 $ hg init a
351 351 $ cd a
352 352
353 353 $ hg qimport -n foo - << EOF
354 354 > # HG changeset patch
355 355 > # Date 1 0
356 356 > diff -r 2588a8b53d66 a
357 357 > --- /dev/null Thu Jan 01 00:00:00 1970 +0000
358 358 > +++ b/a Wed Jul 23 15:54:29 2008 +0200
359 359 > @@ -0,0 +1,1 @@
360 360 > +a
361 361 > EOF
362 362 adding foo to series file
363 363
364 364 $ hg qpush
365 365 applying foo
366 366 now at: foo
367 367
368 368 $ cd ..
369 369 $ linkcp a b
370 370 $ cd b
371 371
372 372 $ hg qimport -n bar - << EOF
373 373 > # HG changeset patch
374 374 > # Date 2 0
375 375 > diff -r 2588a8b53d66 a
376 376 > --- /dev/null Thu Jan 01 00:00:00 1970 +0000
377 377 > +++ b/b Wed Jul 23 15:54:29 2008 +0200
378 378 > @@ -0,0 +1,1 @@
379 379 > +b
380 380 > EOF
381 381 adding bar to series file
382 382
383 383 $ hg qpush
384 384 applying bar
385 385 now at: bar
386 386
387 387 $ cat .hg/patches/status
388 388 430ed4828a74fa4047bc816a25500f7472ab4bfe:foo
389 389 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c:bar
390 390
391 391 $ cat .hg/patches/series
392 392 foo
393 393 bar
394 394
395 395 $ cat ../a/.hg/patches/status
396 396 430ed4828a74fa4047bc816a25500f7472ab4bfe:foo
397 397
398 398 $ cat ../a/.hg/patches/series
399 399 foo
400 400
401 401 Test tags hardlinking:
402 402
403 403 $ hg qdel -r qbase:qtip
404 404 patch foo finalized without changeset message
405 405 patch bar finalized without changeset message
406 406
407 407 $ hg tag -l lfoo
408 408 $ hg tag foo
409 409
410 410 $ cd ..
411 411 $ linkcp b c
412 412 $ cd c
413 413
414 414 $ hg tag -l -r 0 lbar
415 415 $ hg tag -r 0 bar
416 416
417 417 $ cat .hgtags
418 418 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
419 419 430ed4828a74fa4047bc816a25500f7472ab4bfe bar
420 420
421 421 $ cat .hg/localtags
422 422 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
423 423 430ed4828a74fa4047bc816a25500f7472ab4bfe lbar
424 424
425 425 $ cat ../b/.hgtags
426 426 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
427 427
428 428 $ cat ../b/.hg/localtags
429 429 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
430 430
431 431 $ cd ..
@@ -1,173 +1,173 b''
1 1 #require unix-permissions
2 2
3 3 test that new files created in .hg inherit the permissions from .hg/store
4 4
5 5 $ mkdir dir
6 6
7 7 just in case somebody has a strange $TMPDIR
8 8
9 9 $ chmod g-s dir
10 10 $ cd dir
11 11
12 12 $ cat >printmodes.py <<EOF
13 13 > from __future__ import absolute_import, print_function
14 14 > import os
15 15 > import sys
16 16 >
17 17 > allnames = []
18 18 > isdir = {}
19 19 > for root, dirs, files in os.walk(sys.argv[1]):
20 20 > for d in dirs:
21 21 > name = os.path.join(root, d)
22 22 > isdir[name] = 1
23 23 > allnames.append(name)
24 24 > for f in files:
25 25 > name = os.path.join(root, f)
26 26 > allnames.append(name)
27 27 > allnames.sort()
28 28 > for name in allnames:
29 29 > suffix = name in isdir and '/' or ''
30 30 > print('%05o %s%s' % (os.lstat(name).st_mode & 0o7777, name, suffix))
31 31 > EOF
32 32
33 33 $ cat >mode.py <<EOF
34 34 > from __future__ import absolute_import, print_function
35 35 > import os
36 36 > import sys
37 37 > print('%05o' % os.lstat(sys.argv[1]).st_mode)
38 38 > EOF
39 39
40 40 $ umask 077
41 41
42 42 $ hg init repo
43 43 $ cd repo
44 44
45 45 $ chmod 0770 .hg/store
46 46
47 47 before commit
48 48 store can be written by the group, other files cannot
49 49 store is setgid
50 50
51 51 $ $PYTHON ../printmodes.py .
52 52 00700 ./.hg/
53 53 00600 ./.hg/00changelog.i
54 54 00600 ./.hg/requires
55 55 00770 ./.hg/store/
56 56
57 57 $ mkdir dir
58 58 $ touch foo dir/bar
59 59 $ hg ci -qAm 'add files'
60 60
61 61 after commit
62 62 working dir files can only be written by the owner
63 63 files created in .hg can be written by the group
64 64 (in particular, store/**, dirstate, branch cache file, undo files)
65 65 new directories are setgid
66 66
67 67 $ $PYTHON ../printmodes.py .
68 68 00700 ./.hg/
69 69 00600 ./.hg/00changelog.i
70 70 00770 ./.hg/cache/
71 71 00660 ./.hg/cache/branch2-served
72 00660 ./.hg/cache/manifestfulltextcache
72 00660 ./.hg/cache/manifestfulltextcache (reporevlogstore !)
73 73 00660 ./.hg/cache/rbc-names-v1
74 74 00660 ./.hg/cache/rbc-revs-v1
75 75 00660 ./.hg/dirstate
76 76 00660 ./.hg/fsmonitor.state (fsmonitor !)
77 77 00660 ./.hg/last-message.txt
78 78 00600 ./.hg/requires
79 79 00770 ./.hg/store/
80 80 00660 ./.hg/store/00changelog.i
81 81 00660 ./.hg/store/00manifest.i
82 82 00770 ./.hg/store/data/
83 83 00770 ./.hg/store/data/dir/
84 84 00660 ./.hg/store/data/dir/bar.i (reporevlogstore !)
85 85 00660 ./.hg/store/data/foo.i (reporevlogstore !)
86 86 00770 ./.hg/store/data/dir/bar/ (reposimplestore !)
87 87 00660 ./.hg/store/data/dir/bar/b80de5d138758541c5f05265ad144ab9fa86d1db (reposimplestore !)
88 88 00660 ./.hg/store/data/dir/bar/index (reposimplestore !)
89 89 00770 ./.hg/store/data/foo/ (reposimplestore !)
90 90 00660 ./.hg/store/data/foo/b80de5d138758541c5f05265ad144ab9fa86d1db (reposimplestore !)
91 91 00660 ./.hg/store/data/foo/index (reposimplestore !)
92 92 00660 ./.hg/store/fncache (repofncache !)
93 93 00660 ./.hg/store/phaseroots
94 94 00660 ./.hg/store/undo
95 95 00660 ./.hg/store/undo.backupfiles
96 96 00660 ./.hg/store/undo.phaseroots
97 97 00660 ./.hg/undo.backup.dirstate
98 98 00660 ./.hg/undo.bookmarks
99 99 00660 ./.hg/undo.branch
100 100 00660 ./.hg/undo.desc
101 101 00660 ./.hg/undo.dirstate
102 102 00700 ./dir/
103 103 00600 ./dir/bar
104 104 00600 ./foo
105 105
106 106 $ umask 007
107 107 $ hg init ../push
108 108
109 109 before push
110 110 group can write everything
111 111
112 112 $ $PYTHON ../printmodes.py ../push
113 113 00770 ../push/.hg/
114 114 00660 ../push/.hg/00changelog.i
115 115 00660 ../push/.hg/requires
116 116 00770 ../push/.hg/store/
117 117
118 118 $ umask 077
119 119 $ hg -q push ../push
120 120
121 121 after push
122 122 group can still write everything
123 123
124 124 $ $PYTHON ../printmodes.py ../push
125 125 00770 ../push/.hg/
126 126 00660 ../push/.hg/00changelog.i
127 127 00770 ../push/.hg/cache/
128 128 00660 ../push/.hg/cache/branch2-base
129 129 00660 ../push/.hg/dirstate
130 130 00660 ../push/.hg/requires
131 131 00770 ../push/.hg/store/
132 132 00660 ../push/.hg/store/00changelog.i
133 133 00660 ../push/.hg/store/00manifest.i
134 134 00770 ../push/.hg/store/data/
135 135 00770 ../push/.hg/store/data/dir/
136 136 00660 ../push/.hg/store/data/dir/bar.i (reporevlogstore !)
137 137 00660 ../push/.hg/store/data/foo.i (reporevlogstore !)
138 138 00770 ../push/.hg/store/data/dir/bar/ (reposimplestore !)
139 139 00660 ../push/.hg/store/data/dir/bar/b80de5d138758541c5f05265ad144ab9fa86d1db (reposimplestore !)
140 140 00660 ../push/.hg/store/data/dir/bar/index (reposimplestore !)
141 141 00770 ../push/.hg/store/data/foo/ (reposimplestore !)
142 142 00660 ../push/.hg/store/data/foo/b80de5d138758541c5f05265ad144ab9fa86d1db (reposimplestore !)
143 143 00660 ../push/.hg/store/data/foo/index (reposimplestore !)
144 144 00660 ../push/.hg/store/fncache (repofncache !)
145 145 00660 ../push/.hg/store/undo
146 146 00660 ../push/.hg/store/undo.backupfiles
147 147 00660 ../push/.hg/store/undo.phaseroots
148 148 00660 ../push/.hg/undo.bookmarks
149 149 00660 ../push/.hg/undo.branch
150 150 00660 ../push/.hg/undo.desc
151 151 00660 ../push/.hg/undo.dirstate
152 152
153 153
154 154 Test that we don't lose the setgid bit when we call chmod.
155 155 Not all systems support setgid directories (e.g. HFS+), so
156 156 just check that directories have the same mode.
157 157
158 158 $ cd ..
159 159 $ hg init setgid
160 160 $ cd setgid
161 161 $ chmod g+rwx .hg/store
162 162 $ chmod g+s .hg/store 2> /dev/null || true
163 163 $ mkdir dir
164 164 $ touch dir/file
165 165 $ hg ci -qAm 'add dir/file'
166 166 $ storemode=`$PYTHON ../mode.py .hg/store`
167 167 $ dirmode=`$PYTHON ../mode.py .hg/store/data/dir`
168 168 $ if [ "$storemode" != "$dirmode" ]; then
169 169 > echo "$storemode != $dirmode"
170 170 > fi
171 171 $ cd ..
172 172
173 173 $ cd .. # g-s dir
@@ -1,445 +1,445 b''
1 1 $ echo "[extensions]" >> $HGRCPATH
2 2 $ echo "share = " >> $HGRCPATH
3 3
4 4 prepare repo1
5 5
6 6 $ hg init repo1
7 7 $ cd repo1
8 8 $ echo a > a
9 9 $ hg commit -A -m'init'
10 10 adding a
11 11
12 12 share it
13 13
14 14 $ cd ..
15 15 $ hg share repo1 repo2
16 16 updating working directory
17 17 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
18 18
19 19 share shouldn't have a store dir
20 20
21 21 $ cd repo2
22 22 $ test -d .hg/store
23 23 [1]
24 24
25 25 share shouldn't have a cache dir, original repo should
26 26
27 27 $ hg branches
28 28 default 0:d3873e73d99e
29 29 $ hg tags
30 30 tip 0:d3873e73d99e
31 31 $ test -d .hg/cache
32 32 [1]
33 33 $ ls -1 ../repo1/.hg/cache
34 34 branch2-served
35 manifestfulltextcache
35 manifestfulltextcache (reporevlogstore !)
36 36 rbc-names-v1
37 37 rbc-revs-v1
38 38 tags2-visible
39 39
40 40 Some sed versions appends newline, some don't, and some just fails
41 41
42 42 $ cat .hg/sharedpath; echo
43 43 $TESTTMP/repo1/.hg
44 44
45 45 trailing newline on .hg/sharedpath is ok
46 46 $ hg tip -q
47 47 0:d3873e73d99e
48 48 $ echo '' >> .hg/sharedpath
49 49 $ cat .hg/sharedpath
50 50 $TESTTMP/repo1/.hg
51 51 $ hg tip -q
52 52 0:d3873e73d99e
53 53
54 54 commit in shared clone
55 55
56 56 $ echo a >> a
57 57 $ hg commit -m'change in shared clone'
58 58
59 59 check original
60 60
61 61 $ cd ../repo1
62 62 $ hg log
63 63 changeset: 1:8af4dc49db9e
64 64 tag: tip
65 65 user: test
66 66 date: Thu Jan 01 00:00:00 1970 +0000
67 67 summary: change in shared clone
68 68
69 69 changeset: 0:d3873e73d99e
70 70 user: test
71 71 date: Thu Jan 01 00:00:00 1970 +0000
72 72 summary: init
73 73
74 74 $ hg update
75 75 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
76 76 $ cat a # should be two lines of "a"
77 77 a
78 78 a
79 79
80 80 commit in original
81 81
82 82 $ echo b > b
83 83 $ hg commit -A -m'another file'
84 84 adding b
85 85
86 86 check in shared clone
87 87
88 88 $ cd ../repo2
89 89 $ hg log
90 90 changeset: 2:c2e0ac586386
91 91 tag: tip
92 92 user: test
93 93 date: Thu Jan 01 00:00:00 1970 +0000
94 94 summary: another file
95 95
96 96 changeset: 1:8af4dc49db9e
97 97 user: test
98 98 date: Thu Jan 01 00:00:00 1970 +0000
99 99 summary: change in shared clone
100 100
101 101 changeset: 0:d3873e73d99e
102 102 user: test
103 103 date: Thu Jan 01 00:00:00 1970 +0000
104 104 summary: init
105 105
106 106 $ hg update
107 107 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
108 108 $ cat b # should exist with one "b"
109 109 b
110 110
111 111 hg serve shared clone
112 112
113 113 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid
114 114 $ cat hg.pid >> $DAEMON_PIDS
115 115 $ get-with-headers.py localhost:$HGPORT 'raw-file/'
116 116 200 Script output follows
117 117
118 118
119 119 -rw-r--r-- 4 a
120 120 -rw-r--r-- 2 b
121 121
122 122
123 123
124 124 test unshare command
125 125
126 126 $ hg unshare
127 127 $ test -d .hg/store
128 128 $ test -f .hg/sharedpath
129 129 [1]
130 130 $ grep shared .hg/requires
131 131 [1]
132 132 $ hg unshare
133 133 abort: this is not a shared repo
134 134 [255]
135 135
136 136 check that a change does not propagate
137 137
138 138 $ echo b >> b
139 139 $ hg commit -m'change in unshared'
140 140 $ cd ../repo1
141 141 $ hg id -r tip
142 142 c2e0ac586386 tip
143 143
144 144 $ cd ..
145 145
146 146
147 147 test sharing bookmarks
148 148
149 149 $ hg share -B repo1 repo3
150 150 updating working directory
151 151 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
152 152 $ cd repo1
153 153 $ hg bookmark bm1
154 154 $ hg bookmarks
155 155 * bm1 2:c2e0ac586386
156 156 $ cd ../repo2
157 157 $ hg book bm2
158 158 $ hg bookmarks
159 159 * bm2 3:0e6e70d1d5f1
160 160 $ cd ../repo3
161 161 $ hg bookmarks
162 162 bm1 2:c2e0ac586386
163 163 $ hg book bm3
164 164 $ hg bookmarks
165 165 bm1 2:c2e0ac586386
166 166 * bm3 2:c2e0ac586386
167 167 $ cd ../repo1
168 168 $ hg bookmarks
169 169 * bm1 2:c2e0ac586386
170 170 bm3 2:c2e0ac586386
171 171
172 172 check whether HG_PENDING makes pending changes only in relatd
173 173 repositories visible to an external hook.
174 174
175 175 In "hg share" case, another transaction can't run in other
176 176 repositories sharing same source repository, because starting
177 177 transaction requires locking store of source repository.
178 178
179 179 Therefore, this test scenario ignores checking visibility of
180 180 .hg/bookmakrs.pending in repo2, which shares repo1 without bookmarks.
181 181
182 182 $ cat > $TESTTMP/checkbookmarks.sh <<EOF
183 183 > echo "@repo1"
184 184 > hg -R "$TESTTMP/repo1" bookmarks
185 185 > echo "@repo2"
186 186 > hg -R "$TESTTMP/repo2" bookmarks
187 187 > echo "@repo3"
188 188 > hg -R "$TESTTMP/repo3" bookmarks
189 189 > exit 1 # to avoid adding new bookmark for subsequent tests
190 190 > EOF
191 191
192 192 $ cd ../repo1
193 193 $ hg --config hooks.pretxnclose="sh $TESTTMP/checkbookmarks.sh" -q book bmX
194 194 @repo1
195 195 bm1 2:c2e0ac586386
196 196 bm3 2:c2e0ac586386
197 197 * bmX 2:c2e0ac586386
198 198 @repo2
199 199 * bm2 3:0e6e70d1d5f1
200 200 @repo3
201 201 bm1 2:c2e0ac586386
202 202 * bm3 2:c2e0ac586386
203 203 bmX 2:c2e0ac586386
204 204 transaction abort!
205 205 rollback completed
206 206 abort: pretxnclose hook exited with status 1
207 207 [255]
208 208 $ hg book bm1
209 209
210 210 FYI, in contrast to above test, bmX is invisible in repo1 (= shared
211 211 src), because (1) HG_PENDING refers only repo3 and (2)
212 212 "bookmarks.pending" is written only into repo3.
213 213
214 214 $ cd ../repo3
215 215 $ hg --config hooks.pretxnclose="sh $TESTTMP/checkbookmarks.sh" -q book bmX
216 216 @repo1
217 217 * bm1 2:c2e0ac586386
218 218 bm3 2:c2e0ac586386
219 219 @repo2
220 220 * bm2 3:0e6e70d1d5f1
221 221 @repo3
222 222 bm1 2:c2e0ac586386
223 223 bm3 2:c2e0ac586386
224 224 * bmX 2:c2e0ac586386
225 225 transaction abort!
226 226 rollback completed
227 227 abort: pretxnclose hook exited with status 1
228 228 [255]
229 229 $ hg book bm3
230 230
231 231 $ cd ../repo1
232 232
233 233 test that commits work
234 234
235 235 $ echo 'shared bookmarks' > a
236 236 $ hg commit -m 'testing shared bookmarks'
237 237 $ hg bookmarks
238 238 * bm1 3:b87954705719
239 239 bm3 2:c2e0ac586386
240 240 $ cd ../repo3
241 241 $ hg bookmarks
242 242 bm1 3:b87954705719
243 243 * bm3 2:c2e0ac586386
244 244 $ echo 'more shared bookmarks' > a
245 245 $ hg commit -m 'testing shared bookmarks'
246 246 created new head
247 247 $ hg bookmarks
248 248 bm1 3:b87954705719
249 249 * bm3 4:62f4ded848e4
250 250 $ cd ../repo1
251 251 $ hg bookmarks
252 252 * bm1 3:b87954705719
253 253 bm3 4:62f4ded848e4
254 254 $ cd ..
255 255
256 256 non largefiles repos won't enable largefiles
257 257
258 258 $ hg share --config extensions.largefiles= repo3 sharedrepo
259 259 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
260 260 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
261 261 updating working directory
262 262 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
263 263 $ [ -f sharedrepo/.hg/hgrc ]
264 264 [1]
265 265
266 266 test pushing bookmarks works
267 267
268 268 $ hg clone repo3 repo4
269 269 updating to branch default
270 270 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
271 271 $ cd repo4
272 272 $ hg boo bm4
273 273 $ echo foo > b
274 274 $ hg commit -m 'foo in b'
275 275 $ hg boo
276 276 bm1 3:b87954705719
277 277 bm3 4:62f4ded848e4
278 278 * bm4 5:92793bfc8cad
279 279 $ hg push -B bm4
280 280 pushing to $TESTTMP/repo3
281 281 searching for changes
282 282 adding changesets
283 283 adding manifests
284 284 adding file changes
285 285 added 1 changesets with 1 changes to 1 files
286 286 exporting bookmark bm4
287 287 $ cd ../repo1
288 288 $ hg bookmarks
289 289 * bm1 3:b87954705719
290 290 bm3 4:62f4ded848e4
291 291 bm4 5:92793bfc8cad
292 292 $ cd ../repo3
293 293 $ hg bookmarks
294 294 bm1 3:b87954705719
295 295 * bm3 4:62f4ded848e4
296 296 bm4 5:92793bfc8cad
297 297 $ cd ..
298 298
299 299 test behavior when sharing a shared repo
300 300
301 301 $ hg share -B repo3 missingdir/repo5
302 302 updating working directory
303 303 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
304 304 $ cd missingdir/repo5
305 305 $ hg book
306 306 bm1 3:b87954705719
307 307 bm3 4:62f4ded848e4
308 308 bm4 5:92793bfc8cad
309 309 $ cd ../..
310 310
311 311 test what happens when an active bookmark is deleted
312 312
313 313 $ cd repo1
314 314 $ hg boo -d bm3
315 315 $ hg boo
316 316 * bm1 3:b87954705719
317 317 bm4 5:92793bfc8cad
318 318 $ cd ../repo3
319 319 $ hg boo
320 320 bm1 3:b87954705719
321 321 bm4 5:92793bfc8cad
322 322 $ cd ..
323 323
324 324 verify that bookmarks are not written on failed transaction
325 325
326 326 $ cat > failpullbookmarks.py << EOF
327 327 > """A small extension that makes bookmark pulls fail, for testing"""
328 328 > from __future__ import absolute_import
329 329 > from mercurial import (
330 330 > error,
331 331 > exchange,
332 332 > extensions,
333 333 > )
334 334 > def _pullbookmarks(orig, pullop):
335 335 > orig(pullop)
336 336 > raise error.HookAbort('forced failure by extension')
337 337 > def extsetup(ui):
338 338 > extensions.wrapfunction(exchange, '_pullbookmarks', _pullbookmarks)
339 339 > EOF
340 340 $ cd repo4
341 341 $ hg boo
342 342 bm1 3:b87954705719
343 343 bm3 4:62f4ded848e4
344 344 * bm4 5:92793bfc8cad
345 345 $ cd ../repo3
346 346 $ hg boo
347 347 bm1 3:b87954705719
348 348 bm4 5:92793bfc8cad
349 349 $ hg --config "extensions.failpullbookmarks=$TESTTMP/failpullbookmarks.py" pull $TESTTMP/repo4
350 350 pulling from $TESTTMP/repo4
351 351 searching for changes
352 352 no changes found
353 353 adding remote bookmark bm3
354 354 abort: forced failure by extension
355 355 [255]
356 356 $ hg boo
357 357 bm1 3:b87954705719
358 358 bm4 5:92793bfc8cad
359 359 $ hg pull $TESTTMP/repo4
360 360 pulling from $TESTTMP/repo4
361 361 searching for changes
362 362 no changes found
363 363 adding remote bookmark bm3
364 364 1 local changesets published
365 365 $ hg boo
366 366 bm1 3:b87954705719
367 367 * bm3 4:62f4ded848e4
368 368 bm4 5:92793bfc8cad
369 369 $ cd ..
370 370
371 371 verify bookmark behavior after unshare
372 372
373 373 $ cd repo3
374 374 $ hg unshare
375 375 $ hg boo
376 376 bm1 3:b87954705719
377 377 * bm3 4:62f4ded848e4
378 378 bm4 5:92793bfc8cad
379 379 $ hg boo -d bm4
380 380 $ hg boo bm5
381 381 $ hg boo
382 382 bm1 3:b87954705719
383 383 bm3 4:62f4ded848e4
384 384 * bm5 4:62f4ded848e4
385 385 $ cd ../repo1
386 386 $ hg boo
387 387 * bm1 3:b87954705719
388 388 bm3 4:62f4ded848e4
389 389 bm4 5:92793bfc8cad
390 390 $ cd ..
391 391
392 392 test shared clones using relative paths work
393 393
394 394 $ mkdir thisdir
395 395 $ hg init thisdir/orig
396 396 $ hg share -U thisdir/orig thisdir/abs
397 397 $ hg share -U --relative thisdir/abs thisdir/rel
398 398 $ cat thisdir/rel/.hg/sharedpath
399 399 ../../orig/.hg (no-eol)
400 400 $ grep shared thisdir/*/.hg/requires
401 401 thisdir/abs/.hg/requires:shared
402 402 thisdir/rel/.hg/requires:shared
403 403 thisdir/rel/.hg/requires:relshared
404 404
405 405 test that relative shared paths aren't relative to $PWD
406 406
407 407 $ cd thisdir
408 408 $ hg -R rel root
409 409 $TESTTMP/thisdir/rel
410 410 $ cd ..
411 411
412 412 now test that relative paths really are relative, survive across
413 413 renames and changes of PWD
414 414
415 415 $ hg -R thisdir/abs root
416 416 $TESTTMP/thisdir/abs
417 417 $ hg -R thisdir/rel root
418 418 $TESTTMP/thisdir/rel
419 419 $ mv thisdir thatdir
420 420 $ hg -R thatdir/abs root
421 421 abort: .hg/sharedpath points to nonexistent directory $TESTTMP/thisdir/orig/.hg!
422 422 [255]
423 423 $ hg -R thatdir/rel root
424 424 $TESTTMP/thatdir/rel
425 425
426 426 test unshare relshared repo
427 427
428 428 $ cd thatdir/rel
429 429 $ hg unshare
430 430 $ test -d .hg/store
431 431 $ test -f .hg/sharedpath
432 432 [1]
433 433 $ grep shared .hg/requires
434 434 [1]
435 435 $ hg unshare
436 436 abort: this is not a shared repo
437 437 [255]
438 438 $ cd ../..
439 439
440 440 $ rm -r thatdir
441 441
442 442 Explicitly kill daemons to let the test exit on Windows
443 443
444 444 $ killdaemons.py
445 445
General Comments 0
You need to be logged in to leave comments. Login now