##// END OF EJS Templates
test-largefiles: demonstrate problems with renaming and reverting a directory...
Matt Harbison -
r35174:9fb2b0b4 stable
parent child Browse files
Show More
@@ -1,1829 +1,1832 b''
1 1 $ hg init a
2 2 $ mkdir a/d1
3 3 $ mkdir a/d1/d2
4 4 $ echo line 1 > a/a
5 5 $ echo line 1 > a/d1/d2/a
6 6 $ hg --cwd a ci -Ama
7 7 adding a
8 8 adding d1/d2/a
9 9
10 10 $ echo line 2 >> a/a
11 11 $ hg --cwd a ci -u someone -d '1 0' -m'second change'
12 12
13 13 import with no args:
14 14
15 15 $ hg --cwd a import
16 16 abort: need at least one patch to import
17 17 [255]
18 18
19 19 generate patches for the test
20 20
21 21 $ hg --cwd a export tip > exported-tip.patch
22 22 $ hg --cwd a diff -r0:1 > diffed-tip.patch
23 23
24 24
25 25 import exported patch
26 26 (this also tests that editor is not invoked, if the patch contains the
27 27 commit message and '--edit' is not specified)
28 28
29 29 $ hg clone -r0 a b
30 30 adding changesets
31 31 adding manifests
32 32 adding file changes
33 33 added 1 changesets with 2 changes to 2 files
34 34 new changesets 80971e65b431
35 35 updating to branch default
36 36 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
37 37 $ HGEDITOR=cat hg --cwd b import ../exported-tip.patch
38 38 applying ../exported-tip.patch
39 39
40 40 message and committer and date should be same
41 41
42 42 $ hg --cwd b tip
43 43 changeset: 1:1d4bd90af0e4
44 44 tag: tip
45 45 user: someone
46 46 date: Thu Jan 01 00:00:01 1970 +0000
47 47 summary: second change
48 48
49 49 $ rm -r b
50 50
51 51
52 52 import exported patch with external patcher
53 53 (this also tests that editor is invoked, if the '--edit' is specified,
54 54 regardless of the commit message in the patch)
55 55
56 56 $ cat > dummypatch.py <<EOF
57 57 > from __future__ import print_function
58 58 > print('patching file a')
59 59 > file('a', 'wb').write('line2\n')
60 60 > EOF
61 61 $ hg clone -r0 a b
62 62 adding changesets
63 63 adding manifests
64 64 adding file changes
65 65 added 1 changesets with 2 changes to 2 files
66 66 new changesets 80971e65b431
67 67 updating to branch default
68 68 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
69 69 $ HGEDITOR=cat hg --config ui.patch="$PYTHON ../dummypatch.py" --cwd b import --edit ../exported-tip.patch
70 70 applying ../exported-tip.patch
71 71 second change
72 72
73 73
74 74 HG: Enter commit message. Lines beginning with 'HG:' are removed.
75 75 HG: Leave message empty to abort commit.
76 76 HG: --
77 77 HG: user: someone
78 78 HG: branch 'default'
79 79 HG: changed a
80 80 $ cat b/a
81 81 line2
82 82 $ rm -r b
83 83
84 84
85 85 import of plain diff should fail without message
86 86 (this also tests that editor is invoked, if the patch doesn't contain
87 87 the commit message, regardless of '--edit')
88 88
89 89 $ hg clone -r0 a b
90 90 adding changesets
91 91 adding manifests
92 92 adding file changes
93 93 added 1 changesets with 2 changes to 2 files
94 94 new changesets 80971e65b431
95 95 updating to branch default
96 96 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
97 97 $ cat > $TESTTMP/editor.sh <<EOF
98 98 > env | grep HGEDITFORM
99 99 > cat \$1
100 100 > EOF
101 101 $ HGEDITOR="sh $TESTTMP/editor.sh" hg --cwd b import ../diffed-tip.patch
102 102 applying ../diffed-tip.patch
103 103 HGEDITFORM=import.normal.normal
104 104
105 105
106 106 HG: Enter commit message. Lines beginning with 'HG:' are removed.
107 107 HG: Leave message empty to abort commit.
108 108 HG: --
109 109 HG: user: test
110 110 HG: branch 'default'
111 111 HG: changed a
112 112 abort: empty commit message
113 113 [255]
114 114
115 115 Test avoiding editor invocation at applying the patch with --exact,
116 116 even if commit message is empty
117 117
118 118 $ echo a >> b/a
119 119 $ hg --cwd b commit -m ' '
120 120 $ hg --cwd b tip -T "{node}\n"
121 121 d8804f3f5396d800812f579c8452796a5993bdb2
122 122 $ hg --cwd b export -o ../empty-log.diff .
123 123 $ hg --cwd b update -q -C ".^1"
124 124 $ hg --cwd b --config extensions.strip= strip -q tip
125 125 $ HGEDITOR=cat hg --cwd b import --exact ../empty-log.diff
126 126 applying ../empty-log.diff
127 127 $ hg --cwd b tip -T "{node}\n"
128 128 d8804f3f5396d800812f579c8452796a5993bdb2
129 129
130 130 $ rm -r b
131 131
132 132
133 133 import of plain diff should be ok with message
134 134
135 135 $ hg clone -r0 a b
136 136 adding changesets
137 137 adding manifests
138 138 adding file changes
139 139 added 1 changesets with 2 changes to 2 files
140 140 new changesets 80971e65b431
141 141 updating to branch default
142 142 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
143 143 $ hg --cwd b import -mpatch ../diffed-tip.patch
144 144 applying ../diffed-tip.patch
145 145 $ rm -r b
146 146
147 147
148 148 import of plain diff with specific date and user
149 149 (this also tests that editor is not invoked, if
150 150 '--message'/'--logfile' is specified and '--edit' is not)
151 151
152 152 $ hg clone -r0 a b
153 153 adding changesets
154 154 adding manifests
155 155 adding file changes
156 156 added 1 changesets with 2 changes to 2 files
157 157 new changesets 80971e65b431
158 158 updating to branch default
159 159 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
160 160 $ hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../diffed-tip.patch
161 161 applying ../diffed-tip.patch
162 162 $ hg -R b tip -pv
163 163 changeset: 1:ca68f19f3a40
164 164 tag: tip
165 165 user: user@nowhere.net
166 166 date: Thu Jan 01 00:00:01 1970 +0000
167 167 files: a
168 168 description:
169 169 patch
170 170
171 171
172 172 diff -r 80971e65b431 -r ca68f19f3a40 a
173 173 --- a/a Thu Jan 01 00:00:00 1970 +0000
174 174 +++ b/a Thu Jan 01 00:00:01 1970 +0000
175 175 @@ -1,1 +1,2 @@
176 176 line 1
177 177 +line 2
178 178
179 179 $ rm -r b
180 180
181 181
182 182 import of plain diff should be ok with --no-commit
183 183 (this also tests that editor is not invoked, if '--no-commit' is
184 184 specified, regardless of '--edit')
185 185
186 186 $ hg clone -r0 a b
187 187 adding changesets
188 188 adding manifests
189 189 adding file changes
190 190 added 1 changesets with 2 changes to 2 files
191 191 new changesets 80971e65b431
192 192 updating to branch default
193 193 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
194 194 $ HGEDITOR=cat hg --cwd b import --no-commit --edit ../diffed-tip.patch
195 195 applying ../diffed-tip.patch
196 196 $ hg --cwd b diff --nodates
197 197 diff -r 80971e65b431 a
198 198 --- a/a
199 199 +++ b/a
200 200 @@ -1,1 +1,2 @@
201 201 line 1
202 202 +line 2
203 203 $ rm -r b
204 204
205 205
206 206 import of malformed plain diff should fail
207 207
208 208 $ hg clone -r0 a b
209 209 adding changesets
210 210 adding manifests
211 211 adding file changes
212 212 added 1 changesets with 2 changes to 2 files
213 213 new changesets 80971e65b431
214 214 updating to branch default
215 215 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
216 216 $ sed 's/1,1/foo/' < diffed-tip.patch > broken.patch
217 217 $ hg --cwd b import -mpatch ../broken.patch
218 218 applying ../broken.patch
219 219 abort: bad hunk #1
220 220 [255]
221 221 $ rm -r b
222 222
223 223
224 224 hg -R repo import
225 225 put the clone in a subdir - having a directory named "a"
226 226 used to hide a bug.
227 227
228 228 $ mkdir dir
229 229 $ hg clone -r0 a dir/b
230 230 adding changesets
231 231 adding manifests
232 232 adding file changes
233 233 added 1 changesets with 2 changes to 2 files
234 234 new changesets 80971e65b431
235 235 updating to branch default
236 236 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
237 237 $ cd dir
238 238 $ hg -R b import ../exported-tip.patch
239 239 applying ../exported-tip.patch
240 240 $ cd ..
241 241 $ rm -r dir
242 242
243 243
244 244 import from stdin
245 245
246 246 $ hg clone -r0 a b
247 247 adding changesets
248 248 adding manifests
249 249 adding file changes
250 250 added 1 changesets with 2 changes to 2 files
251 251 new changesets 80971e65b431
252 252 updating to branch default
253 253 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
254 254 $ hg --cwd b import - < exported-tip.patch
255 255 applying patch from stdin
256 256 $ rm -r b
257 257
258 258
259 259 import two patches in one stream
260 260
261 261 $ hg init b
262 262 $ hg --cwd a export 0:tip | hg --cwd b import -
263 263 applying patch from stdin
264 264 $ hg --cwd a id
265 265 1d4bd90af0e4 tip
266 266 $ hg --cwd b id
267 267 1d4bd90af0e4 tip
268 268 $ rm -r b
269 269
270 270
271 271 override commit message
272 272
273 273 $ hg clone -r0 a b
274 274 adding changesets
275 275 adding manifests
276 276 adding file changes
277 277 added 1 changesets with 2 changes to 2 files
278 278 new changesets 80971e65b431
279 279 updating to branch default
280 280 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
281 281 $ hg --cwd b import -m 'override' - < exported-tip.patch
282 282 applying patch from stdin
283 283 $ hg --cwd b tip | grep override
284 284 summary: override
285 285 $ rm -r b
286 286
287 287 $ cat > mkmsg.py <<EOF
288 288 > import email.Message, sys
289 289 > msg = email.Message.Message()
290 290 > patch = open(sys.argv[1], 'rb').read()
291 291 > msg.set_payload('email commit message\n' + patch)
292 292 > msg['Subject'] = 'email patch'
293 293 > msg['From'] = 'email patcher'
294 294 > file(sys.argv[2], 'wb').write(msg.as_string())
295 295 > EOF
296 296
297 297
298 298 plain diff in email, subject, message body
299 299
300 300 $ hg clone -r0 a b
301 301 adding changesets
302 302 adding manifests
303 303 adding file changes
304 304 added 1 changesets with 2 changes to 2 files
305 305 new changesets 80971e65b431
306 306 updating to branch default
307 307 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
308 308 $ $PYTHON mkmsg.py diffed-tip.patch msg.patch
309 309 $ hg --cwd b import ../msg.patch
310 310 applying ../msg.patch
311 311 $ hg --cwd b tip | grep email
312 312 user: email patcher
313 313 summary: email patch
314 314 $ rm -r b
315 315
316 316
317 317 plain diff in email, no subject, message body
318 318
319 319 $ hg clone -r0 a b
320 320 adding changesets
321 321 adding manifests
322 322 adding file changes
323 323 added 1 changesets with 2 changes to 2 files
324 324 new changesets 80971e65b431
325 325 updating to branch default
326 326 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
327 327 $ grep -v '^Subject:' msg.patch | hg --cwd b import -
328 328 applying patch from stdin
329 329 $ rm -r b
330 330
331 331
332 332 plain diff in email, subject, no message body
333 333
334 334 $ hg clone -r0 a b
335 335 adding changesets
336 336 adding manifests
337 337 adding file changes
338 338 added 1 changesets with 2 changes to 2 files
339 339 new changesets 80971e65b431
340 340 updating to branch default
341 341 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
342 342 $ grep -v '^email ' msg.patch | hg --cwd b import -
343 343 applying patch from stdin
344 344 $ rm -r b
345 345
346 346
347 347 plain diff in email, no subject, no message body, should fail
348 348
349 349 $ hg clone -r0 a b
350 350 adding changesets
351 351 adding manifests
352 352 adding file changes
353 353 added 1 changesets with 2 changes to 2 files
354 354 new changesets 80971e65b431
355 355 updating to branch default
356 356 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
357 357 $ egrep -v '^(Subject|email)' msg.patch | hg --cwd b import -
358 358 applying patch from stdin
359 359 abort: empty commit message
360 360 [255]
361 361 $ rm -r b
362 362
363 363
364 364 hg export in email, should use patch header
365 365
366 366 $ hg clone -r0 a b
367 367 adding changesets
368 368 adding manifests
369 369 adding file changes
370 370 added 1 changesets with 2 changes to 2 files
371 371 new changesets 80971e65b431
372 372 updating to branch default
373 373 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
374 374 $ $PYTHON mkmsg.py exported-tip.patch msg.patch
375 375 $ cat msg.patch | hg --cwd b import -
376 376 applying patch from stdin
377 377 $ hg --cwd b tip | grep second
378 378 summary: second change
379 379 $ rm -r b
380 380
381 381
382 382 subject: duplicate detection, removal of [PATCH]
383 383 The '---' tests the gitsendmail handling without proper mail headers
384 384
385 385 $ cat > mkmsg2.py <<EOF
386 386 > import email.Message, sys
387 387 > msg = email.Message.Message()
388 388 > patch = open(sys.argv[1], 'rb').read()
389 389 > msg.set_payload('email patch\n\nnext line\n---\n' + patch)
390 390 > msg['Subject'] = '[PATCH] email patch'
391 391 > msg['From'] = 'email patcher'
392 392 > file(sys.argv[2], 'wb').write(msg.as_string())
393 393 > EOF
394 394
395 395
396 396 plain diff in email, [PATCH] subject, message body with subject
397 397
398 398 $ hg clone -r0 a b
399 399 adding changesets
400 400 adding manifests
401 401 adding file changes
402 402 added 1 changesets with 2 changes to 2 files
403 403 new changesets 80971e65b431
404 404 updating to branch default
405 405 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
406 406 $ $PYTHON mkmsg2.py diffed-tip.patch msg.patch
407 407 $ cat msg.patch | hg --cwd b import -
408 408 applying patch from stdin
409 409 $ hg --cwd b tip --template '{desc}\n'
410 410 email patch
411 411
412 412 next line
413 413 $ rm -r b
414 414
415 415
416 416 Issue963: Parent of working dir incorrect after import of multiple
417 417 patches and rollback
418 418
419 419 We weren't backing up the correct dirstate file when importing many
420 420 patches: import patch1 patch2; rollback
421 421
422 422 $ echo line 3 >> a/a
423 423 $ hg --cwd a ci -m'third change'
424 424 $ hg --cwd a export -o '../patch%R' 1 2
425 425 $ hg clone -qr0 a b
426 426 $ hg --cwd b parents --template 'parent: {rev}\n'
427 427 parent: 0
428 428 $ hg --cwd b import -v ../patch1 ../patch2
429 429 applying ../patch1
430 430 patching file a
431 431 committing files:
432 432 a
433 433 committing manifest
434 434 committing changelog
435 435 created 1d4bd90af0e4
436 436 applying ../patch2
437 437 patching file a
438 438 committing files:
439 439 a
440 440 committing manifest
441 441 committing changelog
442 442 created 6d019af21222
443 443 $ hg --cwd b rollback
444 444 repository tip rolled back to revision 0 (undo import)
445 445 working directory now based on revision 0
446 446 $ hg --cwd b parents --template 'parent: {rev}\n'
447 447 parent: 0
448 448
449 449 Test that "hg rollback" doesn't restore dirstate to one at the
450 450 beginning of the rolled back transaction in not-"parent-gone" case.
451 451
452 452 invoking pretxncommit hook will cause marking '.hg/dirstate' as a file
453 453 to be restored when rolling back, after DirstateTransactionPlan (see wiki
454 454 page for detail).
455 455
456 456 $ hg --cwd b branch -q foobar
457 457 $ hg --cwd b commit -m foobar
458 458 $ hg --cwd b update 0 -q
459 459 $ hg --cwd b import ../patch1 ../patch2 --config hooks.pretxncommit=true
460 460 applying ../patch1
461 461 applying ../patch2
462 462 $ hg --cwd b update -q 1
463 463 $ hg --cwd b rollback -q
464 464 $ hg --cwd b parents --template 'parent: {rev}\n'
465 465 parent: 1
466 466
467 467 $ hg --cwd b update -q -C 0
468 468 $ hg --cwd b --config extensions.strip= strip -q 1
469 469
470 470 Test visibility of in-memory dirstate changes inside transaction to
471 471 external process
472 472
473 473 $ echo foo > a/foo
474 474 $ hg --cwd a commit -A -m 'adding foo' foo
475 475 $ hg --cwd a export -o '../patch%R' 3
476 476
477 477 $ cat > $TESTTMP/checkvisibility.sh <<EOF
478 478 > echo "===="
479 479 > hg parents --template "VISIBLE {rev}:{node|short}\n"
480 480 > hg status -amr
481 481 > # test that pending changes are hidden
482 482 > unset HG_PENDING
483 483 > hg parents --template "ACTUAL {rev}:{node|short}\n"
484 484 > hg status -amr
485 485 > echo "===="
486 486 > EOF
487 487
488 488 == test visibility to external editor
489 489
490 490 $ (cd b && sh "$TESTTMP/checkvisibility.sh")
491 491 ====
492 492 VISIBLE 0:80971e65b431
493 493 ACTUAL 0:80971e65b431
494 494 ====
495 495
496 496 $ HGEDITOR="sh $TESTTMP/checkvisibility.sh" hg --cwd b import -v --edit ../patch1 ../patch2 ../patch3
497 497 applying ../patch1
498 498 patching file a
499 499 ====
500 500 VISIBLE 0:80971e65b431
501 501 M a
502 502 ACTUAL 0:80971e65b431
503 503 M a
504 504 ====
505 505 committing files:
506 506 a
507 507 committing manifest
508 508 committing changelog
509 509 created 1d4bd90af0e4
510 510 applying ../patch2
511 511 patching file a
512 512 ====
513 513 VISIBLE 1:1d4bd90af0e4
514 514 M a
515 515 ACTUAL 0:80971e65b431
516 516 M a
517 517 ====
518 518 committing files:
519 519 a
520 520 committing manifest
521 521 committing changelog
522 522 created 6d019af21222
523 523 applying ../patch3
524 524 patching file foo
525 525 adding foo
526 526 ====
527 527 VISIBLE 2:6d019af21222
528 528 A foo
529 529 ACTUAL 0:80971e65b431
530 530 M a
531 531 ====
532 532 committing files:
533 533 foo
534 534 committing manifest
535 535 committing changelog
536 536 created 55e3f75b2378
537 537
538 538 $ hg --cwd b rollback -q
539 539
540 540 (content of file "a" is already changed and it should be recognized as
541 541 "M", even though dirstate is restored to one before "hg import")
542 542
543 543 $ (cd b && sh "$TESTTMP/checkvisibility.sh")
544 544 ====
545 545 VISIBLE 0:80971e65b431
546 546 M a
547 547 ACTUAL 0:80971e65b431
548 548 M a
549 549 ====
550 550 $ hg --cwd b revert --no-backup a
551 551 $ rm -f b/foo
552 552
553 553 == test visibility to precommit external hook
554 554
555 555 $ cat >> b/.hg/hgrc <<EOF
556 556 > [hooks]
557 557 > precommit.visibility = sh $TESTTMP/checkvisibility.sh
558 558 > EOF
559 559
560 560 $ (cd b && sh "$TESTTMP/checkvisibility.sh")
561 561 ====
562 562 VISIBLE 0:80971e65b431
563 563 ACTUAL 0:80971e65b431
564 564 ====
565 565
566 566 $ hg --cwd b import ../patch1 ../patch2 ../patch3
567 567 applying ../patch1
568 568 ====
569 569 VISIBLE 0:80971e65b431
570 570 M a
571 571 ACTUAL 0:80971e65b431
572 572 M a
573 573 ====
574 574 applying ../patch2
575 575 ====
576 576 VISIBLE 1:1d4bd90af0e4
577 577 M a
578 578 ACTUAL 0:80971e65b431
579 579 M a
580 580 ====
581 581 applying ../patch3
582 582 ====
583 583 VISIBLE 2:6d019af21222
584 584 A foo
585 585 ACTUAL 0:80971e65b431
586 586 M a
587 587 ====
588 588
589 589 $ hg --cwd b rollback -q
590 590 $ (cd b && sh "$TESTTMP/checkvisibility.sh")
591 591 ====
592 592 VISIBLE 0:80971e65b431
593 593 M a
594 594 ACTUAL 0:80971e65b431
595 595 M a
596 596 ====
597 597 $ hg --cwd b revert --no-backup a
598 598 $ rm -f b/foo
599 599
600 600 $ cat >> b/.hg/hgrc <<EOF
601 601 > [hooks]
602 602 > precommit.visibility =
603 603 > EOF
604 604
605 605 == test visibility to pretxncommit external hook
606 606
607 607 $ cat >> b/.hg/hgrc <<EOF
608 608 > [hooks]
609 609 > pretxncommit.visibility = sh $TESTTMP/checkvisibility.sh
610 610 > EOF
611 611
612 612 $ (cd b && sh "$TESTTMP/checkvisibility.sh")
613 613 ====
614 614 VISIBLE 0:80971e65b431
615 615 ACTUAL 0:80971e65b431
616 616 ====
617 617
618 618 $ hg --cwd b import ../patch1 ../patch2 ../patch3
619 619 applying ../patch1
620 620 ====
621 621 VISIBLE 0:80971e65b431
622 622 M a
623 623 ACTUAL 0:80971e65b431
624 624 M a
625 625 ====
626 626 applying ../patch2
627 627 ====
628 628 VISIBLE 1:1d4bd90af0e4
629 629 M a
630 630 ACTUAL 0:80971e65b431
631 631 M a
632 632 ====
633 633 applying ../patch3
634 634 ====
635 635 VISIBLE 2:6d019af21222
636 636 A foo
637 637 ACTUAL 0:80971e65b431
638 638 M a
639 639 ====
640 640
641 641 $ hg --cwd b rollback -q
642 642 $ (cd b && sh "$TESTTMP/checkvisibility.sh")
643 643 ====
644 644 VISIBLE 0:80971e65b431
645 645 M a
646 646 ACTUAL 0:80971e65b431
647 647 M a
648 648 ====
649 649 $ hg --cwd b revert --no-backup a
650 650 $ rm -f b/foo
651 651
652 652 $ cat >> b/.hg/hgrc <<EOF
653 653 > [hooks]
654 654 > pretxncommit.visibility =
655 655 > EOF
656 656
657 657 $ rm -r b
658 658
659 659
660 660 importing a patch in a subdirectory failed at the commit stage
661 661
662 662 $ echo line 2 >> a/d1/d2/a
663 663 $ hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change'
664 664
665 665 hg import in a subdirectory
666 666
667 667 $ hg clone -r0 a b
668 668 adding changesets
669 669 adding manifests
670 670 adding file changes
671 671 added 1 changesets with 2 changes to 2 files
672 672 new changesets 80971e65b431
673 673 updating to branch default
674 674 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
675 675 $ hg --cwd a export tip > tmp
676 676 $ sed -e 's/d1\/d2\///' < tmp > subdir-tip.patch
677 677 $ dir=`pwd`
678 678 $ cd b/d1/d2 2>&1 > /dev/null
679 679 $ hg import ../../../subdir-tip.patch
680 680 applying ../../../subdir-tip.patch
681 681 $ cd "$dir"
682 682
683 683 message should be 'subdir change'
684 684 committer should be 'someoneelse'
685 685
686 686 $ hg --cwd b tip
687 687 changeset: 1:3577f5aea227
688 688 tag: tip
689 689 user: someoneelse
690 690 date: Thu Jan 01 00:00:01 1970 +0000
691 691 summary: subdir change
692 692
693 693
694 694 should be empty
695 695
696 696 $ hg --cwd b status
697 697
698 698
699 699 Test fuzziness (ambiguous patch location, fuzz=2)
700 700
701 701 $ hg init fuzzy
702 702 $ cd fuzzy
703 703 $ echo line1 > a
704 704 $ echo line0 >> a
705 705 $ echo line3 >> a
706 706 $ hg ci -Am adda
707 707 adding a
708 708 $ echo line1 > a
709 709 $ echo line2 >> a
710 710 $ echo line0 >> a
711 711 $ echo line3 >> a
712 712 $ hg ci -m change a
713 713 $ hg export tip > fuzzy-tip.patch
714 714 $ hg up -C 0
715 715 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
716 716 $ echo line1 > a
717 717 $ echo line0 >> a
718 718 $ echo line1 >> a
719 719 $ echo line0 >> a
720 720 $ hg ci -m brancha
721 721 created new head
722 722 $ hg import --config patch.fuzz=0 -v fuzzy-tip.patch
723 723 applying fuzzy-tip.patch
724 724 patching file a
725 725 Hunk #1 FAILED at 0
726 726 1 out of 1 hunks FAILED -- saving rejects to file a.rej
727 727 abort: patch failed to apply
728 728 [255]
729 729 $ hg import --no-commit -v fuzzy-tip.patch
730 730 applying fuzzy-tip.patch
731 731 patching file a
732 732 Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines).
733 733 applied to working directory
734 734 $ hg revert -a
735 735 reverting a
736 736
737 737
738 738 import with --no-commit should have written .hg/last-message.txt
739 739
740 740 $ cat .hg/last-message.txt
741 741 change (no-eol)
742 742
743 743
744 744 test fuzziness with eol=auto
745 745
746 746 $ hg --config patch.eol=auto import --no-commit -v fuzzy-tip.patch
747 747 applying fuzzy-tip.patch
748 748 patching file a
749 749 Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines).
750 750 applied to working directory
751 751 $ cd ..
752 752
753 753
754 754 Test hunk touching empty files (issue906)
755 755
756 756 $ hg init empty
757 757 $ cd empty
758 758 $ touch a
759 759 $ touch b1
760 760 $ touch c1
761 761 $ echo d > d
762 762 $ hg ci -Am init
763 763 adding a
764 764 adding b1
765 765 adding c1
766 766 adding d
767 767 $ echo a > a
768 768 $ echo b > b1
769 769 $ hg mv b1 b2
770 770 $ echo c > c1
771 771 $ hg copy c1 c2
772 772 $ rm d
773 773 $ touch d
774 774 $ hg diff --git
775 775 diff --git a/a b/a
776 776 --- a/a
777 777 +++ b/a
778 778 @@ -0,0 +1,1 @@
779 779 +a
780 780 diff --git a/b1 b/b2
781 781 rename from b1
782 782 rename to b2
783 783 --- a/b1
784 784 +++ b/b2
785 785 @@ -0,0 +1,1 @@
786 786 +b
787 787 diff --git a/c1 b/c1
788 788 --- a/c1
789 789 +++ b/c1
790 790 @@ -0,0 +1,1 @@
791 791 +c
792 792 diff --git a/c1 b/c2
793 793 copy from c1
794 794 copy to c2
795 795 --- a/c1
796 796 +++ b/c2
797 797 @@ -0,0 +1,1 @@
798 798 +c
799 799 diff --git a/d b/d
800 800 --- a/d
801 801 +++ b/d
802 802 @@ -1,1 +0,0 @@
803 803 -d
804 804 $ hg ci -m empty
805 805 $ hg export --git tip > empty.diff
806 806 $ hg up -C 0
807 807 4 files updated, 0 files merged, 2 files removed, 0 files unresolved
808 808 $ hg import empty.diff
809 809 applying empty.diff
810 810 $ for name in a b1 b2 c1 c2 d; do
811 811 > echo % $name file
812 812 > test -f $name && cat $name
813 813 > done
814 814 % a file
815 815 a
816 816 % b1 file
817 817 % b2 file
818 818 b
819 819 % c1 file
820 820 c
821 821 % c2 file
822 822 c
823 823 % d file
824 824 $ cd ..
825 825
826 826
827 827 Test importing a patch ending with a binary file removal
828 828
829 829 $ hg init binaryremoval
830 830 $ cd binaryremoval
831 831 $ echo a > a
832 832 $ $PYTHON -c "file('b', 'wb').write('a\x00b')"
833 833 $ hg ci -Am addall
834 834 adding a
835 835 adding b
836 836 $ hg rm a
837 837 $ hg rm b
838 838 $ hg st
839 839 R a
840 840 R b
841 841 $ hg ci -m remove
842 842 $ hg export --git . > remove.diff
843 843 $ cat remove.diff | grep git
844 844 diff --git a/a b/a
845 845 diff --git a/b b/b
846 846 $ hg up -C 0
847 847 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
848 848 $ hg import remove.diff
849 849 applying remove.diff
850 850 $ hg manifest
851 851 $ cd ..
852 852
853 853
854 854 Issue927: test update+rename with common name
855 855
856 856 $ hg init t
857 857 $ cd t
858 858 $ touch a
859 859 $ hg ci -Am t
860 860 adding a
861 861 $ echo a > a
862 862
863 863 Here, bfile.startswith(afile)
864 864
865 865 $ hg copy a a2
866 866 $ hg ci -m copya
867 867 $ hg export --git tip > copy.diff
868 868 $ hg up -C 0
869 869 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
870 870 $ hg import copy.diff
871 871 applying copy.diff
872 872
873 873 a should contain an 'a'
874 874
875 875 $ cat a
876 876 a
877 877
878 878 and a2 should have duplicated it
879 879
880 880 $ cat a2
881 881 a
882 882 $ cd ..
883 883
884 884
885 885 test -p0
886 886
887 887 $ hg init p0
888 888 $ cd p0
889 889 $ echo a > a
890 890 $ hg ci -Am t
891 891 adding a
892 892 $ hg import -p foo
893 893 abort: invalid value 'foo' for option -p, expected int
894 894 [255]
895 895 $ hg import -p0 - << EOF
896 896 > foobar
897 897 > --- a Sat Apr 12 22:43:58 2008 -0400
898 898 > +++ a Sat Apr 12 22:44:05 2008 -0400
899 899 > @@ -1,1 +1,1 @@
900 900 > -a
901 901 > +bb
902 902 > EOF
903 903 applying patch from stdin
904 904 $ hg status
905 905 $ cat a
906 906 bb
907 907
908 908 test --prefix
909 909
910 910 $ mkdir -p dir/dir2
911 911 $ echo b > dir/dir2/b
912 912 $ hg ci -Am b
913 913 adding dir/dir2/b
914 914 $ hg import -p2 --prefix dir - << EOF
915 915 > foobar
916 916 > --- drop1/drop2/dir2/b
917 917 > +++ drop1/drop2/dir2/b
918 918 > @@ -1,1 +1,1 @@
919 919 > -b
920 920 > +cc
921 921 > EOF
922 922 applying patch from stdin
923 923 $ hg status
924 924 $ cat dir/dir2/b
925 925 cc
926 926 $ cd ..
927 927
928 928
929 929 test paths outside repo root
930 930
931 931 $ mkdir outside
932 932 $ touch outside/foo
933 933 $ hg init inside
934 934 $ cd inside
935 935 $ hg import - <<EOF
936 936 > diff --git a/a b/b
937 937 > rename from ../outside/foo
938 938 > rename to bar
939 939 > EOF
940 940 applying patch from stdin
941 941 abort: path contains illegal component: ../outside/foo (glob)
942 942 [255]
943 943 $ cd ..
944 944
945 945
946 946 test import with similarity and git and strip (issue295 et al.)
947 947
948 948 $ hg init sim
949 949 $ cd sim
950 950 $ echo 'this is a test' > a
951 951 $ hg ci -Ama
952 952 adding a
953 953 $ cat > ../rename.diff <<EOF
954 954 > diff --git a/foo/a b/foo/a
955 955 > deleted file mode 100644
956 956 > --- a/foo/a
957 957 > +++ /dev/null
958 958 > @@ -1,1 +0,0 @@
959 959 > -this is a test
960 960 > diff --git a/foo/b b/foo/b
961 961 > new file mode 100644
962 962 > --- /dev/null
963 963 > +++ b/foo/b
964 964 > @@ -0,0 +1,2 @@
965 965 > +this is a test
966 966 > +foo
967 967 > EOF
968 968 $ hg import --no-commit -v -s 1 ../rename.diff -p2
969 969 applying ../rename.diff
970 970 patching file a
971 971 patching file b
972 972 adding b
973 973 recording removal of a as rename to b (88% similar)
974 974 applied to working directory
975 $ echo 'mod b' > b
975 976 $ hg st -C
976 977 A b
977 978 a
978 979 R a
979 980 $ hg revert -a
980 981 undeleting a
981 982 forgetting b
983 $ cat b
984 mod b
982 985 $ rm b
983 986 $ hg import --no-commit -v -s 100 ../rename.diff -p2
984 987 applying ../rename.diff
985 988 patching file a
986 989 patching file b
987 990 adding b
988 991 applied to working directory
989 992 $ hg st -C
990 993 A b
991 994 R a
992 995 $ cd ..
993 996
994 997
995 998 Issue1495: add empty file from the end of patch
996 999
997 1000 $ hg init addemptyend
998 1001 $ cd addemptyend
999 1002 $ touch a
1000 1003 $ hg addremove
1001 1004 adding a
1002 1005 $ hg ci -m "commit"
1003 1006 $ cat > a.patch <<EOF
1004 1007 > add a, b
1005 1008 > diff --git a/a b/a
1006 1009 > --- a/a
1007 1010 > +++ b/a
1008 1011 > @@ -0,0 +1,1 @@
1009 1012 > +a
1010 1013 > diff --git a/b b/b
1011 1014 > new file mode 100644
1012 1015 > EOF
1013 1016 $ hg import --no-commit a.patch
1014 1017 applying a.patch
1015 1018
1016 1019 apply a good patch followed by an empty patch (mainly to ensure
1017 1020 that dirstate is *not* updated when import crashes)
1018 1021 $ hg update -q -C .
1019 1022 $ rm b
1020 1023 $ touch empty.patch
1021 1024 $ hg import a.patch empty.patch
1022 1025 applying a.patch
1023 1026 applying empty.patch
1024 1027 transaction abort!
1025 1028 rollback completed
1026 1029 abort: empty.patch: no diffs found
1027 1030 [255]
1028 1031 $ hg tip --template '{rev} {desc|firstline}\n'
1029 1032 0 commit
1030 1033 $ hg -q status
1031 1034 M a
1032 1035 $ cd ..
1033 1036
1034 1037 create file when source is not /dev/null
1035 1038
1036 1039 $ cat > create.patch <<EOF
1037 1040 > diff -Naur proj-orig/foo proj-new/foo
1038 1041 > --- proj-orig/foo 1969-12-31 16:00:00.000000000 -0800
1039 1042 > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
1040 1043 > @@ -0,0 +1,1 @@
1041 1044 > +a
1042 1045 > EOF
1043 1046
1044 1047 some people have patches like the following too
1045 1048
1046 1049 $ cat > create2.patch <<EOF
1047 1050 > diff -Naur proj-orig/foo proj-new/foo
1048 1051 > --- proj-orig/foo.orig 1969-12-31 16:00:00.000000000 -0800
1049 1052 > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
1050 1053 > @@ -0,0 +1,1 @@
1051 1054 > +a
1052 1055 > EOF
1053 1056 $ hg init oddcreate
1054 1057 $ cd oddcreate
1055 1058 $ hg import --no-commit ../create.patch
1056 1059 applying ../create.patch
1057 1060 $ cat foo
1058 1061 a
1059 1062 $ rm foo
1060 1063 $ hg revert foo
1061 1064 $ hg import --no-commit ../create2.patch
1062 1065 applying ../create2.patch
1063 1066 $ cat foo
1064 1067 a
1065 1068
1066 1069 $ cd ..
1067 1070
1068 1071 Issue1859: first line mistaken for email headers
1069 1072
1070 1073 $ hg init emailconfusion
1071 1074 $ cd emailconfusion
1072 1075 $ cat > a.patch <<EOF
1073 1076 > module: summary
1074 1077 >
1075 1078 > description
1076 1079 >
1077 1080 >
1078 1081 > diff -r 000000000000 -r 9b4c1e343b55 test.txt
1079 1082 > --- /dev/null
1080 1083 > +++ b/a
1081 1084 > @@ -0,0 +1,1 @@
1082 1085 > +a
1083 1086 > EOF
1084 1087 $ hg import -d '0 0' a.patch
1085 1088 applying a.patch
1086 1089 $ hg parents -v
1087 1090 changeset: 0:5a681217c0ad
1088 1091 tag: tip
1089 1092 user: test
1090 1093 date: Thu Jan 01 00:00:00 1970 +0000
1091 1094 files: a
1092 1095 description:
1093 1096 module: summary
1094 1097
1095 1098 description
1096 1099
1097 1100
1098 1101 $ cd ..
1099 1102
1100 1103
1101 1104 in commit message
1102 1105
1103 1106 $ hg init commitconfusion
1104 1107 $ cd commitconfusion
1105 1108 $ cat > a.patch <<EOF
1106 1109 > module: summary
1107 1110 >
1108 1111 > --- description
1109 1112 >
1110 1113 > diff --git a/a b/a
1111 1114 > new file mode 100644
1112 1115 > --- /dev/null
1113 1116 > +++ b/a
1114 1117 > @@ -0,0 +1,1 @@
1115 1118 > +a
1116 1119 > EOF
1117 1120 > hg import -d '0 0' a.patch
1118 1121 > hg parents -v
1119 1122 > cd ..
1120 1123 >
1121 1124 > echo '% tricky header splitting'
1122 1125 > cat > trickyheaders.patch <<EOF
1123 1126 > From: User A <user@a>
1124 1127 > Subject: [PATCH] from: tricky!
1125 1128 >
1126 1129 > # HG changeset patch
1127 1130 > # User User B
1128 1131 > # Date 1266264441 18000
1129 1132 > # Branch stable
1130 1133 > # Node ID f2be6a1170ac83bf31cb4ae0bad00d7678115bc0
1131 1134 > # Parent 0000000000000000000000000000000000000000
1132 1135 > from: tricky!
1133 1136 >
1134 1137 > That is not a header.
1135 1138 >
1136 1139 > diff -r 000000000000 -r f2be6a1170ac foo
1137 1140 > --- /dev/null
1138 1141 > +++ b/foo
1139 1142 > @@ -0,0 +1,1 @@
1140 1143 > +foo
1141 1144 > EOF
1142 1145 applying a.patch
1143 1146 changeset: 0:f34d9187897d
1144 1147 tag: tip
1145 1148 user: test
1146 1149 date: Thu Jan 01 00:00:00 1970 +0000
1147 1150 files: a
1148 1151 description:
1149 1152 module: summary
1150 1153
1151 1154
1152 1155 % tricky header splitting
1153 1156
1154 1157 $ hg init trickyheaders
1155 1158 $ cd trickyheaders
1156 1159 $ hg import -d '0 0' ../trickyheaders.patch
1157 1160 applying ../trickyheaders.patch
1158 1161 $ hg export --git tip
1159 1162 # HG changeset patch
1160 1163 # User User B
1161 1164 # Date 0 0
1162 1165 # Thu Jan 01 00:00:00 1970 +0000
1163 1166 # Node ID eb56ab91903632294ac504838508cb370c0901d2
1164 1167 # Parent 0000000000000000000000000000000000000000
1165 1168 from: tricky!
1166 1169
1167 1170 That is not a header.
1168 1171
1169 1172 diff --git a/foo b/foo
1170 1173 new file mode 100644
1171 1174 --- /dev/null
1172 1175 +++ b/foo
1173 1176 @@ -0,0 +1,1 @@
1174 1177 +foo
1175 1178 $ cd ..
1176 1179
1177 1180
1178 1181 Issue2102: hg export and hg import speak different languages
1179 1182
1180 1183 $ hg init issue2102
1181 1184 $ cd issue2102
1182 1185 $ mkdir -p src/cmd/gc
1183 1186 $ touch src/cmd/gc/mksys.bash
1184 1187 $ hg ci -Am init
1185 1188 adding src/cmd/gc/mksys.bash
1186 1189 $ hg import - <<EOF
1187 1190 > # HG changeset patch
1188 1191 > # User Rob Pike
1189 1192 > # Date 1216685449 25200
1190 1193 > # Node ID 03aa2b206f499ad6eb50e6e207b9e710d6409c98
1191 1194 > # Parent 93d10138ad8df586827ca90b4ddb5033e21a3a84
1192 1195 > help management of empty pkg and lib directories in perforce
1193 1196 >
1194 1197 > R=gri
1195 1198 > DELTA=4 (4 added, 0 deleted, 0 changed)
1196 1199 > OCL=13328
1197 1200 > CL=13328
1198 1201 >
1199 1202 > diff --git a/lib/place-holder b/lib/place-holder
1200 1203 > new file mode 100644
1201 1204 > --- /dev/null
1202 1205 > +++ b/lib/place-holder
1203 1206 > @@ -0,0 +1,2 @@
1204 1207 > +perforce does not maintain empty directories.
1205 1208 > +this file helps.
1206 1209 > diff --git a/pkg/place-holder b/pkg/place-holder
1207 1210 > new file mode 100644
1208 1211 > --- /dev/null
1209 1212 > +++ b/pkg/place-holder
1210 1213 > @@ -0,0 +1,2 @@
1211 1214 > +perforce does not maintain empty directories.
1212 1215 > +this file helps.
1213 1216 > diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
1214 1217 > old mode 100644
1215 1218 > new mode 100755
1216 1219 > EOF
1217 1220 applying patch from stdin
1218 1221
1219 1222 #if execbit
1220 1223
1221 1224 $ hg sum
1222 1225 parent: 1:d59915696727 tip
1223 1226 help management of empty pkg and lib directories in perforce
1224 1227 branch: default
1225 1228 commit: (clean)
1226 1229 update: (current)
1227 1230 phases: 2 draft
1228 1231
1229 1232 $ hg diff --git -c tip
1230 1233 diff --git a/lib/place-holder b/lib/place-holder
1231 1234 new file mode 100644
1232 1235 --- /dev/null
1233 1236 +++ b/lib/place-holder
1234 1237 @@ -0,0 +1,2 @@
1235 1238 +perforce does not maintain empty directories.
1236 1239 +this file helps.
1237 1240 diff --git a/pkg/place-holder b/pkg/place-holder
1238 1241 new file mode 100644
1239 1242 --- /dev/null
1240 1243 +++ b/pkg/place-holder
1241 1244 @@ -0,0 +1,2 @@
1242 1245 +perforce does not maintain empty directories.
1243 1246 +this file helps.
1244 1247 diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
1245 1248 old mode 100644
1246 1249 new mode 100755
1247 1250
1248 1251 #else
1249 1252
1250 1253 $ hg sum
1251 1254 parent: 1:28f089cc9ccc tip
1252 1255 help management of empty pkg and lib directories in perforce
1253 1256 branch: default
1254 1257 commit: (clean)
1255 1258 update: (current)
1256 1259 phases: 2 draft
1257 1260
1258 1261 $ hg diff --git -c tip
1259 1262 diff --git a/lib/place-holder b/lib/place-holder
1260 1263 new file mode 100644
1261 1264 --- /dev/null
1262 1265 +++ b/lib/place-holder
1263 1266 @@ -0,0 +1,2 @@
1264 1267 +perforce does not maintain empty directories.
1265 1268 +this file helps.
1266 1269 diff --git a/pkg/place-holder b/pkg/place-holder
1267 1270 new file mode 100644
1268 1271 --- /dev/null
1269 1272 +++ b/pkg/place-holder
1270 1273 @@ -0,0 +1,2 @@
1271 1274 +perforce does not maintain empty directories.
1272 1275 +this file helps.
1273 1276
1274 1277 /* The mode change for mksys.bash is missing here, because on platforms */
1275 1278 /* that don't support execbits, mode changes in patches are ignored when */
1276 1279 /* they are imported. This is obviously also the reason for why the hash */
1277 1280 /* in the created changeset is different to the one you see above the */
1278 1281 /* #else clause */
1279 1282
1280 1283 #endif
1281 1284 $ cd ..
1282 1285
1283 1286
1284 1287 diff lines looking like headers
1285 1288
1286 1289 $ hg init difflineslikeheaders
1287 1290 $ cd difflineslikeheaders
1288 1291 $ echo a >a
1289 1292 $ echo b >b
1290 1293 $ echo c >c
1291 1294 $ hg ci -Am1
1292 1295 adding a
1293 1296 adding b
1294 1297 adding c
1295 1298
1296 1299 $ echo "key: value" >>a
1297 1300 $ echo "key: value" >>b
1298 1301 $ echo "foo" >>c
1299 1302 $ hg ci -m2
1300 1303
1301 1304 $ hg up -C 0
1302 1305 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1303 1306 $ hg diff --git -c1 >want
1304 1307 $ hg diff -c1 | hg import --no-commit -
1305 1308 applying patch from stdin
1306 1309 $ hg diff --git >have
1307 1310 $ diff want have
1308 1311 $ cd ..
1309 1312
1310 1313 import a unified diff with no lines of context (diff -U0)
1311 1314
1312 1315 $ hg init diffzero
1313 1316 $ cd diffzero
1314 1317 $ cat > f << EOF
1315 1318 > c2
1316 1319 > c4
1317 1320 > c5
1318 1321 > EOF
1319 1322 $ hg commit -Am0
1320 1323 adding f
1321 1324
1322 1325 $ hg import --no-commit - << EOF
1323 1326 > # HG changeset patch
1324 1327 > # User test
1325 1328 > # Date 0 0
1326 1329 > # Node ID f4974ab632f3dee767567b0576c0ec9a4508575c
1327 1330 > # Parent 8679a12a975b819fae5f7ad3853a2886d143d794
1328 1331 > 1
1329 1332 > diff -r 8679a12a975b -r f4974ab632f3 f
1330 1333 > --- a/f Thu Jan 01 00:00:00 1970 +0000
1331 1334 > +++ b/f Thu Jan 01 00:00:00 1970 +0000
1332 1335 > @@ -0,0 +1,1 @@
1333 1336 > +c1
1334 1337 > @@ -1,0 +3,1 @@
1335 1338 > +c3
1336 1339 > @@ -3,1 +4,0 @@
1337 1340 > -c5
1338 1341 > EOF
1339 1342 applying patch from stdin
1340 1343
1341 1344 $ cat f
1342 1345 c1
1343 1346 c2
1344 1347 c3
1345 1348 c4
1346 1349
1347 1350 $ cd ..
1348 1351
1349 1352 no segfault while importing a unified diff which start line is zero but chunk
1350 1353 size is non-zero
1351 1354
1352 1355 $ hg init startlinezero
1353 1356 $ cd startlinezero
1354 1357 $ echo foo > foo
1355 1358 $ hg commit -Amfoo
1356 1359 adding foo
1357 1360
1358 1361 $ hg import --no-commit - << EOF
1359 1362 > diff a/foo b/foo
1360 1363 > --- a/foo
1361 1364 > +++ b/foo
1362 1365 > @@ -0,1 +0,1 @@
1363 1366 > foo
1364 1367 > EOF
1365 1368 applying patch from stdin
1366 1369
1367 1370 $ cd ..
1368 1371
1369 1372 Test corner case involving fuzz and skew
1370 1373
1371 1374 $ hg init morecornercases
1372 1375 $ cd morecornercases
1373 1376
1374 1377 $ cat > 01-no-context-beginning-of-file.diff <<EOF
1375 1378 > diff --git a/a b/a
1376 1379 > --- a/a
1377 1380 > +++ b/a
1378 1381 > @@ -1,0 +1,1 @@
1379 1382 > +line
1380 1383 > EOF
1381 1384
1382 1385 $ cat > 02-no-context-middle-of-file.diff <<EOF
1383 1386 > diff --git a/a b/a
1384 1387 > --- a/a
1385 1388 > +++ b/a
1386 1389 > @@ -1,1 +1,1 @@
1387 1390 > -2
1388 1391 > +add some skew
1389 1392 > @@ -2,0 +2,1 @@
1390 1393 > +line
1391 1394 > EOF
1392 1395
1393 1396 $ cat > 03-no-context-end-of-file.diff <<EOF
1394 1397 > diff --git a/a b/a
1395 1398 > --- a/a
1396 1399 > +++ b/a
1397 1400 > @@ -10,0 +10,1 @@
1398 1401 > +line
1399 1402 > EOF
1400 1403
1401 1404 $ cat > 04-middle-of-file-completely-fuzzed.diff <<EOF
1402 1405 > diff --git a/a b/a
1403 1406 > --- a/a
1404 1407 > +++ b/a
1405 1408 > @@ -1,1 +1,1 @@
1406 1409 > -2
1407 1410 > +add some skew
1408 1411 > @@ -2,2 +2,3 @@
1409 1412 > not matching, should fuzz
1410 1413 > ... a bit
1411 1414 > +line
1412 1415 > EOF
1413 1416
1414 1417 $ cat > a <<EOF
1415 1418 > 1
1416 1419 > 2
1417 1420 > 3
1418 1421 > 4
1419 1422 > EOF
1420 1423 $ hg ci -Am adda a
1421 1424 $ for p in *.diff; do
1422 1425 > hg import -v --no-commit $p
1423 1426 > cat a
1424 1427 > hg revert -aqC a
1425 1428 > # patch -p1 < $p
1426 1429 > # cat a
1427 1430 > # hg revert -aC a
1428 1431 > done
1429 1432 applying 01-no-context-beginning-of-file.diff
1430 1433 patching file a
1431 1434 applied to working directory
1432 1435 1
1433 1436 line
1434 1437 2
1435 1438 3
1436 1439 4
1437 1440 applying 02-no-context-middle-of-file.diff
1438 1441 patching file a
1439 1442 Hunk #1 succeeded at 2 (offset 1 lines).
1440 1443 Hunk #2 succeeded at 4 (offset 1 lines).
1441 1444 applied to working directory
1442 1445 1
1443 1446 add some skew
1444 1447 3
1445 1448 line
1446 1449 4
1447 1450 applying 03-no-context-end-of-file.diff
1448 1451 patching file a
1449 1452 Hunk #1 succeeded at 5 (offset -6 lines).
1450 1453 applied to working directory
1451 1454 1
1452 1455 2
1453 1456 3
1454 1457 4
1455 1458 line
1456 1459 applying 04-middle-of-file-completely-fuzzed.diff
1457 1460 patching file a
1458 1461 Hunk #1 succeeded at 2 (offset 1 lines).
1459 1462 Hunk #2 succeeded at 5 with fuzz 2 (offset 1 lines).
1460 1463 applied to working directory
1461 1464 1
1462 1465 add some skew
1463 1466 3
1464 1467 4
1465 1468 line
1466 1469 $ cd ..
1467 1470
1468 1471 Test partial application
1469 1472 ------------------------
1470 1473
1471 1474 prepare a stack of patches depending on each other
1472 1475
1473 1476 $ hg init partial
1474 1477 $ cd partial
1475 1478 $ cat << EOF > a
1476 1479 > one
1477 1480 > two
1478 1481 > three
1479 1482 > four
1480 1483 > five
1481 1484 > six
1482 1485 > seven
1483 1486 > EOF
1484 1487 $ hg add a
1485 1488 $ echo 'b' > b
1486 1489 $ hg add b
1487 1490 $ hg commit -m 'initial' -u Babar
1488 1491 $ cat << EOF > a
1489 1492 > one
1490 1493 > two
1491 1494 > 3
1492 1495 > four
1493 1496 > five
1494 1497 > six
1495 1498 > seven
1496 1499 > EOF
1497 1500 $ hg commit -m 'three' -u Celeste
1498 1501 $ cat << EOF > a
1499 1502 > one
1500 1503 > two
1501 1504 > 3
1502 1505 > 4
1503 1506 > five
1504 1507 > six
1505 1508 > seven
1506 1509 > EOF
1507 1510 $ hg commit -m 'four' -u Rataxes
1508 1511 $ cat << EOF > a
1509 1512 > one
1510 1513 > two
1511 1514 > 3
1512 1515 > 4
1513 1516 > 5
1514 1517 > six
1515 1518 > seven
1516 1519 > EOF
1517 1520 $ echo bb >> b
1518 1521 $ hg commit -m 'five' -u Arthur
1519 1522 $ echo 'Babar' > jungle
1520 1523 $ hg add jungle
1521 1524 $ hg ci -m 'jungle' -u Zephir
1522 1525 $ echo 'Celeste' >> jungle
1523 1526 $ hg ci -m 'extended jungle' -u Cornelius
1524 1527 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1525 1528 @ extended jungle [Cornelius] 1: +1/-0
1526 1529 |
1527 1530 o jungle [Zephir] 1: +1/-0
1528 1531 |
1529 1532 o five [Arthur] 2: +2/-1
1530 1533 |
1531 1534 o four [Rataxes] 1: +1/-1
1532 1535 |
1533 1536 o three [Celeste] 1: +1/-1
1534 1537 |
1535 1538 o initial [Babar] 2: +8/-0
1536 1539
1537 1540 Adding those config options should not change the output of diffstat. Bugfix #4755.
1538 1541
1539 1542 $ hg log -r . --template '{diffstat}\n'
1540 1543 1: +1/-0
1541 1544 $ hg log -r . --template '{diffstat}\n' --config diff.git=1 \
1542 1545 > --config diff.noprefix=1
1543 1546 1: +1/-0
1544 1547
1545 1548 Importing with some success and some errors:
1546 1549
1547 1550 $ hg update --rev 'desc(initial)'
1548 1551 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1549 1552 $ hg export --rev 'desc(five)' | hg import --partial -
1550 1553 applying patch from stdin
1551 1554 patching file a
1552 1555 Hunk #1 FAILED at 1
1553 1556 1 out of 1 hunks FAILED -- saving rejects to file a.rej
1554 1557 patch applied partially
1555 1558 (fix the .rej files and run `hg commit --amend`)
1556 1559 [1]
1557 1560
1558 1561 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1559 1562 @ five [Arthur] 1: +1/-0
1560 1563 |
1561 1564 | o extended jungle [Cornelius] 1: +1/-0
1562 1565 | |
1563 1566 | o jungle [Zephir] 1: +1/-0
1564 1567 | |
1565 1568 | o five [Arthur] 2: +2/-1
1566 1569 | |
1567 1570 | o four [Rataxes] 1: +1/-1
1568 1571 | |
1569 1572 | o three [Celeste] 1: +1/-1
1570 1573 |/
1571 1574 o initial [Babar] 2: +8/-0
1572 1575
1573 1576 $ hg export
1574 1577 # HG changeset patch
1575 1578 # User Arthur
1576 1579 # Date 0 0
1577 1580 # Thu Jan 01 00:00:00 1970 +0000
1578 1581 # Node ID 26e6446bb2526e2be1037935f5fca2b2706f1509
1579 1582 # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e
1580 1583 five
1581 1584
1582 1585 diff -r 8e4f0351909e -r 26e6446bb252 b
1583 1586 --- a/b Thu Jan 01 00:00:00 1970 +0000
1584 1587 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1585 1588 @@ -1,1 +1,2 @@
1586 1589 b
1587 1590 +bb
1588 1591 $ hg status -c .
1589 1592 C a
1590 1593 C b
1591 1594 $ ls
1592 1595 a
1593 1596 a.rej
1594 1597 b
1595 1598
1596 1599 Importing with zero success:
1597 1600
1598 1601 $ hg update --rev 'desc(initial)'
1599 1602 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1600 1603 $ hg export --rev 'desc(four)' | hg import --partial -
1601 1604 applying patch from stdin
1602 1605 patching file a
1603 1606 Hunk #1 FAILED at 0
1604 1607 1 out of 1 hunks FAILED -- saving rejects to file a.rej
1605 1608 patch applied partially
1606 1609 (fix the .rej files and run `hg commit --amend`)
1607 1610 [1]
1608 1611
1609 1612 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1610 1613 @ four [Rataxes] 0: +0/-0
1611 1614 |
1612 1615 | o five [Arthur] 1: +1/-0
1613 1616 |/
1614 1617 | o extended jungle [Cornelius] 1: +1/-0
1615 1618 | |
1616 1619 | o jungle [Zephir] 1: +1/-0
1617 1620 | |
1618 1621 | o five [Arthur] 2: +2/-1
1619 1622 | |
1620 1623 | o four [Rataxes] 1: +1/-1
1621 1624 | |
1622 1625 | o three [Celeste] 1: +1/-1
1623 1626 |/
1624 1627 o initial [Babar] 2: +8/-0
1625 1628
1626 1629 $ hg export
1627 1630 # HG changeset patch
1628 1631 # User Rataxes
1629 1632 # Date 0 0
1630 1633 # Thu Jan 01 00:00:00 1970 +0000
1631 1634 # Node ID cb9b1847a74d9ad52e93becaf14b98dbcc274e1e
1632 1635 # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e
1633 1636 four
1634 1637
1635 1638 $ hg status -c .
1636 1639 C a
1637 1640 C b
1638 1641 $ ls
1639 1642 a
1640 1643 a.rej
1641 1644 b
1642 1645
1643 1646 Importing with unknown file:
1644 1647
1645 1648 $ hg update --rev 'desc(initial)'
1646 1649 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1647 1650 $ hg export --rev 'desc("extended jungle")' | hg import --partial -
1648 1651 applying patch from stdin
1649 1652 unable to find 'jungle' for patching
1650 1653 (use '--prefix' to apply patch relative to the current directory)
1651 1654 1 out of 1 hunks FAILED -- saving rejects to file jungle.rej
1652 1655 patch applied partially
1653 1656 (fix the .rej files and run `hg commit --amend`)
1654 1657 [1]
1655 1658
1656 1659 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1657 1660 @ extended jungle [Cornelius] 0: +0/-0
1658 1661 |
1659 1662 | o four [Rataxes] 0: +0/-0
1660 1663 |/
1661 1664 | o five [Arthur] 1: +1/-0
1662 1665 |/
1663 1666 | o extended jungle [Cornelius] 1: +1/-0
1664 1667 | |
1665 1668 | o jungle [Zephir] 1: +1/-0
1666 1669 | |
1667 1670 | o five [Arthur] 2: +2/-1
1668 1671 | |
1669 1672 | o four [Rataxes] 1: +1/-1
1670 1673 | |
1671 1674 | o three [Celeste] 1: +1/-1
1672 1675 |/
1673 1676 o initial [Babar] 2: +8/-0
1674 1677
1675 1678 $ hg export
1676 1679 # HG changeset patch
1677 1680 # User Cornelius
1678 1681 # Date 0 0
1679 1682 # Thu Jan 01 00:00:00 1970 +0000
1680 1683 # Node ID 1fb1f86bef43c5a75918178f8d23c29fb0a7398d
1681 1684 # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e
1682 1685 extended jungle
1683 1686
1684 1687 $ hg status -c .
1685 1688 C a
1686 1689 C b
1687 1690 $ ls
1688 1691 a
1689 1692 a.rej
1690 1693 b
1691 1694 jungle.rej
1692 1695
1693 1696 Importing multiple failing patches:
1694 1697
1695 1698 $ hg update --rev 'desc(initial)'
1696 1699 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1697 1700 $ echo 'B' > b # just to make another commit
1698 1701 $ hg commit -m "a new base"
1699 1702 created new head
1700 1703 $ hg export --rev 'desc("four") + desc("extended jungle")' | hg import --partial -
1701 1704 applying patch from stdin
1702 1705 patching file a
1703 1706 Hunk #1 FAILED at 0
1704 1707 1 out of 1 hunks FAILED -- saving rejects to file a.rej
1705 1708 patch applied partially
1706 1709 (fix the .rej files and run `hg commit --amend`)
1707 1710 [1]
1708 1711 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1709 1712 @ four [Rataxes] 0: +0/-0
1710 1713 |
1711 1714 o a new base [test] 1: +1/-1
1712 1715 |
1713 1716 | o extended jungle [Cornelius] 0: +0/-0
1714 1717 |/
1715 1718 | o four [Rataxes] 0: +0/-0
1716 1719 |/
1717 1720 | o five [Arthur] 1: +1/-0
1718 1721 |/
1719 1722 | o extended jungle [Cornelius] 1: +1/-0
1720 1723 | |
1721 1724 | o jungle [Zephir] 1: +1/-0
1722 1725 | |
1723 1726 | o five [Arthur] 2: +2/-1
1724 1727 | |
1725 1728 | o four [Rataxes] 1: +1/-1
1726 1729 | |
1727 1730 | o three [Celeste] 1: +1/-1
1728 1731 |/
1729 1732 o initial [Babar] 2: +8/-0
1730 1733
1731 1734 $ hg export
1732 1735 # HG changeset patch
1733 1736 # User Rataxes
1734 1737 # Date 0 0
1735 1738 # Thu Jan 01 00:00:00 1970 +0000
1736 1739 # Node ID a9d7b6d0ffbb4eb12b7d5939250fcd42e8930a1d
1737 1740 # Parent f59f8d2e95a8ca5b1b4ca64320140da85f3b44fd
1738 1741 four
1739 1742
1740 1743 $ hg status -c .
1741 1744 C a
1742 1745 C b
1743 1746
1744 1747 Importing some extra header
1745 1748 ===========================
1746 1749
1747 1750 $ cat > $TESTTMP/parseextra.py <<EOF
1748 1751 > import mercurial.patch
1749 1752 > import mercurial.cmdutil
1750 1753 >
1751 1754 > def processfoo(repo, data, extra, opts):
1752 1755 > if 'foo' in data:
1753 1756 > extra['foo'] = data['foo']
1754 1757 > def postimport(ctx):
1755 1758 > if 'foo' in ctx.extra():
1756 1759 > ctx.repo().ui.write('imported-foo: %s\n' % ctx.extra()['foo'])
1757 1760 >
1758 1761 > mercurial.patch.patchheadermap.append(('Foo', 'foo'))
1759 1762 > mercurial.cmdutil.extrapreimport.append('foo')
1760 1763 > mercurial.cmdutil.extrapreimportmap['foo'] = processfoo
1761 1764 > mercurial.cmdutil.extrapostimport.append('foo')
1762 1765 > mercurial.cmdutil.extrapostimportmap['foo'] = postimport
1763 1766 > EOF
1764 1767 $ cat >> $HGRCPATH <<EOF
1765 1768 > [extensions]
1766 1769 > parseextra=$TESTTMP/parseextra.py
1767 1770 > EOF
1768 1771 $ hg up -C tip
1769 1772 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1770 1773 $ cat > $TESTTMP/foo.patch <<EOF
1771 1774 > # HG changeset patch
1772 1775 > # User Rataxes
1773 1776 > # Date 0 0
1774 1777 > # Thu Jan 01 00:00:00 1970 +0000
1775 1778 > # Foo bar
1776 1779 > height
1777 1780 >
1778 1781 > --- a/a Thu Jan 01 00:00:00 1970 +0000
1779 1782 > +++ b/a Wed Oct 07 09:17:44 2015 +0000
1780 1783 > @@ -5,3 +5,4 @@
1781 1784 > five
1782 1785 > six
1783 1786 > seven
1784 1787 > +heigt
1785 1788 > EOF
1786 1789 $ hg import $TESTTMP/foo.patch
1787 1790 applying $TESTTMP/foo.patch
1788 1791 imported-foo: bar
1789 1792 $ hg log --debug -r . | grep extra
1790 1793 extra: branch=default
1791 1794 extra: foo=bar
1792 1795
1793 1796 Warn the user that paths are relative to the root of
1794 1797 repository when file not found for patching
1795 1798
1796 1799 $ mkdir filedir
1797 1800 $ echo "file1" >> filedir/file1
1798 1801 $ hg add filedir/file1
1799 1802 $ hg commit -m "file1"
1800 1803 $ cd filedir
1801 1804 $ hg import -p 2 - <<EOF
1802 1805 > # HG changeset patch
1803 1806 > # User test
1804 1807 > # Date 0 0
1805 1808 > file2
1806 1809 >
1807 1810 > diff --git a/filedir/file1 b/filedir/file1
1808 1811 > --- a/filedir/file1
1809 1812 > +++ b/filedir/file1
1810 1813 > @@ -1,1 +1,2 @@
1811 1814 > file1
1812 1815 > +file2
1813 1816 > EOF
1814 1817 applying patch from stdin
1815 1818 unable to find 'file1' for patching
1816 1819 (use '--prefix' to apply patch relative to the current directory)
1817 1820 1 out of 1 hunks FAILED -- saving rejects to file file1.rej
1818 1821 abort: patch failed to apply
1819 1822 [255]
1820 1823
1821 1824 test import crash (issue5375)
1822 1825 $ cd ..
1823 1826 $ hg init repo
1824 1827 $ cd repo
1825 1828 $ printf "diff --git a/a b/b\nrename from a\nrename to b" | hg import -
1826 1829 applying patch from stdin
1827 1830 a not tracked!
1828 1831 abort: source file 'a' does not exist
1829 1832 [255]
@@ -1,1121 +1,1283 b''
1 1 This file contains testcases that tend to be related to special cases or less
2 2 common commands affecting largefile.
3 3
4 4 Each sections should be independent of each others.
5 5
6 6 $ USERCACHE="$TESTTMP/cache"; export USERCACHE
7 7 $ mkdir "${USERCACHE}"
8 8 $ cat >> $HGRCPATH <<EOF
9 9 > [extensions]
10 10 > largefiles=
11 11 > purge=
12 12 > rebase=
13 13 > transplant=
14 14 > [phases]
15 15 > publish=False
16 16 > [largefiles]
17 17 > minsize=2
18 18 > patterns=glob:**.dat
19 19 > usercache=${USERCACHE}
20 20 > [hooks]
21 21 > precommit=sh -c "echo \\"Invoking status precommit hook\\"; hg status"
22 22 > EOF
23 23
24 24
25 25
26 26 Test copies and moves from a directory other than root (issue3516)
27 27 =========================================================================
28 28
29 29 $ hg init lf_cpmv
30 30 $ cd lf_cpmv
31 31 $ mkdir dira
32 32 $ mkdir dira/dirb
33 33 $ touch dira/dirb/largefile
34 34 $ hg add --large dira/dirb/largefile
35 35 $ hg commit -m "added"
36 36 Invoking status precommit hook
37 37 A dira/dirb/largefile
38 38 $ cd dira
39 39 $ hg cp dirb/largefile foo/largefile
40 40
41 41 TODO: Ideally, this should mention the largefile, not the standin
42 42 $ hg log -T '{rev}\n' --stat 'set:clean()'
43 43 0
44 44 .hglf/dira/dirb/largefile | 1 +
45 45 1 files changed, 1 insertions(+), 0 deletions(-)
46 46
47 47 $ hg ci -m "deep copy"
48 48 Invoking status precommit hook
49 49 A dira/foo/largefile
50 50 $ find . | sort
51 51 .
52 52 ./dirb
53 53 ./dirb/largefile
54 54 ./foo
55 55 ./foo/largefile
56 56 $ hg mv foo/largefile baz/largefile
57 57 $ hg ci -m "moved"
58 58 Invoking status precommit hook
59 59 A dira/baz/largefile
60 60 R dira/foo/largefile
61 61 $ find . | sort
62 62 .
63 63 ./baz
64 64 ./baz/largefile
65 65 ./dirb
66 66 ./dirb/largefile
67 67 $ cd ..
68 68 $ hg mv dira dirc
69 69 moving .hglf/dira/baz/largefile to .hglf/dirc/baz/largefile (glob)
70 70 moving .hglf/dira/dirb/largefile to .hglf/dirc/dirb/largefile (glob)
71 71 $ find * | sort
72 72 dirc
73 73 dirc/baz
74 74 dirc/baz/largefile
75 75 dirc/dirb
76 76 dirc/dirb/largefile
77 77
78 78 $ hg clone -q . ../fetch
79 79 $ hg --config extensions.fetch= fetch ../fetch
80 80 abort: uncommitted changes
81 81 [255]
82 82 $ hg up -qC
83 83 $ cd ..
84 84
85 85 Clone a local repository owned by another user
86 86 ===================================================
87 87
88 88 #if unix-permissions
89 89
90 90 We have to simulate that here by setting $HOME and removing write permissions
91 91 $ ORIGHOME="$HOME"
92 92 $ mkdir alice
93 93 $ HOME="`pwd`/alice"
94 94 $ cd alice
95 95 $ hg init pubrepo
96 96 $ cd pubrepo
97 97 $ dd if=/dev/zero bs=1k count=11k > a-large-file 2> /dev/null
98 98 $ hg add --large a-large-file
99 99 $ hg commit -m "Add a large file"
100 100 Invoking status precommit hook
101 101 A a-large-file
102 102 $ cd ..
103 103 $ chmod -R a-w pubrepo
104 104 $ cd ..
105 105 $ mkdir bob
106 106 $ HOME="`pwd`/bob"
107 107 $ cd bob
108 108 $ hg clone --pull ../alice/pubrepo pubrepo
109 109 requesting all changes
110 110 adding changesets
111 111 adding manifests
112 112 adding file changes
113 113 added 1 changesets with 1 changes to 1 files
114 114 new changesets 09a186cfa6da
115 115 updating to branch default
116 116 getting changed largefiles
117 117 1 largefiles updated, 0 removed
118 118 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
119 119 $ cd ..
120 120 $ chmod -R u+w alice/pubrepo
121 121 $ HOME="$ORIGHOME"
122 122
123 123 #endif
124 124
125 125
126 126 Symlink to a large largefile should behave the same as a symlink to a normal file
127 127 =====================================================================================
128 128
129 129 #if symlink
130 130
131 131 $ hg init largesymlink
132 132 $ cd largesymlink
133 133 $ dd if=/dev/zero bs=1k count=10k of=largefile 2>/dev/null
134 134 $ hg add --large largefile
135 135 $ hg commit -m "commit a large file"
136 136 Invoking status precommit hook
137 137 A largefile
138 138 $ ln -s largefile largelink
139 139 $ hg add largelink
140 140 $ hg commit -m "commit a large symlink"
141 141 Invoking status precommit hook
142 142 A largelink
143 143 $ rm -f largelink
144 144 $ hg up >/dev/null
145 145 $ test -f largelink
146 146 [1]
147 147 $ test -L largelink
148 148 [1]
149 149 $ rm -f largelink # make next part of the test independent of the previous
150 150 $ hg up -C >/dev/null
151 151 $ test -f largelink
152 152 $ test -L largelink
153 153 $ cd ..
154 154
155 155 #endif
156 156
157 157
158 158 test for pattern matching on 'hg status':
159 159 ==============================================
160 160
161 161
162 162 to boost performance, largefiles checks whether specified patterns are
163 163 related to largefiles in working directory (NOT to STANDIN) or not.
164 164
165 165 $ hg init statusmatch
166 166 $ cd statusmatch
167 167
168 168 $ mkdir -p a/b/c/d
169 169 $ echo normal > a/b/c/d/e.normal.txt
170 170 $ hg add a/b/c/d/e.normal.txt
171 171 $ echo large > a/b/c/d/e.large.txt
172 172 $ hg add --large a/b/c/d/e.large.txt
173 173 $ mkdir -p a/b/c/x
174 174 $ echo normal > a/b/c/x/y.normal.txt
175 175 $ hg add a/b/c/x/y.normal.txt
176 176 $ hg commit -m 'add files'
177 177 Invoking status precommit hook
178 178 A a/b/c/d/e.large.txt
179 179 A a/b/c/d/e.normal.txt
180 180 A a/b/c/x/y.normal.txt
181 181
182 182 (1) no pattern: no performance boost
183 183 $ hg status -A
184 184 C a/b/c/d/e.large.txt
185 185 C a/b/c/d/e.normal.txt
186 186 C a/b/c/x/y.normal.txt
187 187
188 188 (2) pattern not related to largefiles: performance boost
189 189 $ hg status -A a/b/c/x
190 190 C a/b/c/x/y.normal.txt
191 191
192 192 (3) pattern related to largefiles: no performance boost
193 193 $ hg status -A a/b/c/d
194 194 C a/b/c/d/e.large.txt
195 195 C a/b/c/d/e.normal.txt
196 196
197 197 (4) pattern related to STANDIN (not to largefiles): performance boost
198 198 $ hg status -A .hglf/a
199 199 C .hglf/a/b/c/d/e.large.txt
200 200
201 201 (5) mixed case: no performance boost
202 202 $ hg status -A a/b/c/x a/b/c/d
203 203 C a/b/c/d/e.large.txt
204 204 C a/b/c/d/e.normal.txt
205 205 C a/b/c/x/y.normal.txt
206 206
207 207 verify that largefiles doesn't break filesets
208 208
209 209 $ hg log --rev . --exclude "set:binary()"
210 210 changeset: 0:41bd42f10efa
211 211 tag: tip
212 212 user: test
213 213 date: Thu Jan 01 00:00:00 1970 +0000
214 214 summary: add files
215 215
216 216 sharing a largefile repo automatically enables largefiles on the share
217 217
218 218 $ hg share --config extensions.share= . ../shared_lfrepo
219 219 updating working directory
220 220 getting changed largefiles
221 221 1 largefiles updated, 0 removed
222 222 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
223 223 $ cat ../shared_lfrepo/.hg/hgrc
224 224
225 225 [extensions]
226 226 largefiles=
227 227
228 228 verify that large files in subrepos handled properly
229 229 $ hg init subrepo
230 230 $ echo "subrepo = subrepo" > .hgsub
231 231 $ hg add .hgsub
232 232 $ hg ci -m "add subrepo"
233 233 Invoking status precommit hook
234 234 A .hgsub
235 235 ? .hgsubstate
236 236 $ echo "rev 1" > subrepo/large.txt
237 237 $ hg add --large subrepo/large.txt
238 238 $ hg sum
239 239 parent: 1:8ee150ea2e9c tip
240 240 add subrepo
241 241 branch: default
242 242 commit: 1 subrepos
243 243 update: (current)
244 244 phases: 2 draft
245 245 $ hg st
246 246 $ hg st -S
247 247 A subrepo/large.txt
248 248 $ hg ci -S -m "commit top repo"
249 249 committing subrepository subrepo
250 250 Invoking status precommit hook
251 251 A large.txt
252 252 Invoking status precommit hook
253 253 M .hgsubstate
254 254 # No differences
255 255 $ hg st -S
256 256 $ hg sum
257 257 parent: 2:ce4cd0c527a6 tip
258 258 commit top repo
259 259 branch: default
260 260 commit: (clean)
261 261 update: (current)
262 262 phases: 3 draft
263 263 $ echo "rev 2" > subrepo/large.txt
264 264 $ hg st -S
265 265 M subrepo/large.txt
266 266 $ hg sum
267 267 parent: 2:ce4cd0c527a6 tip
268 268 commit top repo
269 269 branch: default
270 270 commit: 1 subrepos
271 271 update: (current)
272 272 phases: 3 draft
273 273 $ hg ci -m "this commit should fail without -S"
274 274 abort: uncommitted changes in subrepository "subrepo"
275 275 (use --subrepos for recursive commit)
276 276 [255]
277 277
278 278 Add a normal file to the subrepo, then test archiving
279 279
280 280 $ echo 'normal file' > subrepo/normal.txt
281 281 $ touch large.dat
282 282 $ mv subrepo/large.txt subrepo/renamed-large.txt
283 283 $ hg addremove -S --dry-run
284 284 adding large.dat as a largefile
285 285 removing subrepo/large.txt
286 286 adding subrepo/normal.txt
287 287 adding subrepo/renamed-large.txt
288 288 $ hg status -S
289 289 ! subrepo/large.txt
290 290 ? large.dat
291 291 ? subrepo/normal.txt
292 292 ? subrepo/renamed-large.txt
293 293
294 294 $ hg addremove --dry-run subrepo
295 295 removing subrepo/large.txt (glob)
296 296 adding subrepo/normal.txt (glob)
297 297 adding subrepo/renamed-large.txt (glob)
298 298 $ hg status -S
299 299 ! subrepo/large.txt
300 300 ? large.dat
301 301 ? subrepo/normal.txt
302 302 ? subrepo/renamed-large.txt
303 303 $ cd ..
304 304
305 305 $ hg -R statusmatch addremove --dry-run statusmatch/subrepo
306 306 removing statusmatch/subrepo/large.txt (glob)
307 307 adding statusmatch/subrepo/normal.txt (glob)
308 308 adding statusmatch/subrepo/renamed-large.txt (glob)
309 309 $ hg -R statusmatch status -S
310 310 ! subrepo/large.txt
311 311 ? large.dat
312 312 ? subrepo/normal.txt
313 313 ? subrepo/renamed-large.txt
314 314
315 315 $ hg -R statusmatch addremove --dry-run -S
316 316 adding large.dat as a largefile
317 317 removing subrepo/large.txt
318 318 adding subrepo/normal.txt
319 319 adding subrepo/renamed-large.txt
320 320 $ cd statusmatch
321 321
322 322 $ mv subrepo/renamed-large.txt subrepo/large.txt
323 323 $ hg addremove subrepo
324 324 adding subrepo/normal.txt (glob)
325 325 $ hg forget subrepo/normal.txt
326 326
327 327 $ hg addremove -S
328 328 adding large.dat as a largefile
329 329 adding subrepo/normal.txt
330 330 $ rm large.dat
331 331
332 332 $ hg addremove subrepo
333 333 $ hg addremove -S
334 334 removing large.dat
335 335
336 336 Lock in subrepo, otherwise the change isn't archived
337 337
338 338 $ hg ci -S -m "add normal file to top level"
339 339 committing subrepository subrepo
340 340 Invoking status precommit hook
341 341 M large.txt
342 342 A normal.txt
343 343 Invoking status precommit hook
344 344 M .hgsubstate
345 345 $ hg archive -S ../lf_subrepo_archive
346 346 $ find ../lf_subrepo_archive | sort
347 347 ../lf_subrepo_archive
348 348 ../lf_subrepo_archive/.hg_archival.txt
349 349 ../lf_subrepo_archive/.hgsub
350 350 ../lf_subrepo_archive/.hgsubstate
351 351 ../lf_subrepo_archive/a
352 352 ../lf_subrepo_archive/a/b
353 353 ../lf_subrepo_archive/a/b/c
354 354 ../lf_subrepo_archive/a/b/c/d
355 355 ../lf_subrepo_archive/a/b/c/d/e.large.txt
356 356 ../lf_subrepo_archive/a/b/c/d/e.normal.txt
357 357 ../lf_subrepo_archive/a/b/c/x
358 358 ../lf_subrepo_archive/a/b/c/x/y.normal.txt
359 359 ../lf_subrepo_archive/subrepo
360 360 ../lf_subrepo_archive/subrepo/large.txt
361 361 ../lf_subrepo_archive/subrepo/normal.txt
362 362 $ cat ../lf_subrepo_archive/.hg_archival.txt
363 363 repo: 41bd42f10efa43698cc02052ea0977771cba506d
364 364 node: d56a95e6522858bc08a724c4fe2bdee066d1c30b
365 365 branch: default
366 366 latesttag: null
367 367 latesttagdistance: 4
368 368 changessincelatesttag: 4
369 369
370 370 Test update with subrepos.
371 371
372 372 $ hg update 0
373 373 getting changed largefiles
374 374 0 largefiles updated, 1 removed
375 375 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
376 376 $ hg status -S
377 377 $ hg update tip
378 378 getting changed largefiles
379 379 1 largefiles updated, 0 removed
380 380 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
381 381 $ hg status -S
382 382 # modify a large file
383 383 $ echo "modified" > subrepo/large.txt
384 384 $ hg st -S
385 385 M subrepo/large.txt
386 386 # update -C should revert the change.
387 387 $ hg update -C
388 388 getting changed largefiles
389 389 1 largefiles updated, 0 removed
390 390 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
391 391 $ hg status -S
392 392
393 Forget doesn't change the content of the file
394 $ echo 'pre-forget content' > subrepo/large.txt
393 395 $ hg forget -v subrepo/large.txt
394 396 removing subrepo/large.txt (glob)
397 $ cat subrepo/large.txt
398 pre-forget content
395 399
396 400 Test reverting a forgotten file
397 401 $ hg revert -R subrepo subrepo/large.txt
398 402 $ hg status -SA subrepo/large.txt
399 403 C subrepo/large.txt
400 404
401 405 $ hg rm -v subrepo/large.txt
402 406 removing subrepo/large.txt (glob)
403 407 $ hg revert -R subrepo subrepo/large.txt
404 408 $ rm subrepo/large.txt
405 409 $ hg addremove -S
406 410 removing subrepo/large.txt
407 411 $ hg st -S
408 412 R subrepo/large.txt
409 413
410 414 Test archiving a revision that references a subrepo that is not yet
411 415 cloned (see test-subrepo-recursion.t):
412 416
413 417 $ hg clone -U . ../empty
414 418 $ cd ../empty
415 419 $ hg archive --subrepos -r tip ../archive.tar.gz
416 420 cloning subrepo subrepo from $TESTTMP/statusmatch/subrepo
417 421 $ cd ..
418 422
419 423
420 424
421 425
422 426
423 427
424 428 Test addremove, forget and others
425 429 ==============================================
426 430
427 431 Test that addremove picks up largefiles prior to the initial commit (issue3541)
428 432
429 433 $ hg init addrm2
430 434 $ cd addrm2
431 435 $ touch large.dat
432 436 $ touch large2.dat
433 437 $ touch normal
434 438 $ hg add --large large.dat
435 439 $ hg addremove -v
436 440 adding large2.dat as a largefile
437 441 adding normal
438 442
439 443 Test that forgetting all largefiles reverts to islfilesrepo() == False
440 444 (addremove will add *.dat as normal files now)
441 445 $ hg forget large.dat
442 446 $ hg forget large2.dat
443 447 $ hg addremove -v
444 448 adding large.dat
445 449 adding large2.dat
446 450
447 451 Test commit's addremove option prior to the first commit
448 452 $ hg forget large.dat
449 453 $ hg forget large2.dat
450 454 $ hg add --large large.dat
451 455 $ hg ci -Am "commit"
452 456 adding large2.dat as a largefile
453 457 Invoking status precommit hook
454 458 A large.dat
455 459 A large2.dat
456 460 A normal
457 461 $ find .hglf | sort
458 462 .hglf
459 463 .hglf/large.dat
460 464 .hglf/large2.dat
461 465
462 466 Test actions on largefiles using relative paths from subdir
463 467
464 468 $ mkdir sub
465 469 $ cd sub
466 470 $ echo anotherlarge > anotherlarge
467 471 $ hg add --large anotherlarge
468 472 $ hg st
469 473 A sub/anotherlarge
470 474 $ hg st anotherlarge
471 475 A anotherlarge
472 476 $ hg commit -m anotherlarge anotherlarge
473 477 Invoking status precommit hook
474 478 A sub/anotherlarge
475 479 $ hg log anotherlarge
476 480 changeset: 1:9627a577c5e9
477 481 tag: tip
478 482 user: test
479 483 date: Thu Jan 01 00:00:00 1970 +0000
480 484 summary: anotherlarge
481 485
482 486 $ hg --debug log -T '{rev}: {desc}\n' ../sub/anotherlarge
483 487 updated patterns: ../.hglf/sub/../sub/anotherlarge, ../sub/anotherlarge
484 488 1: anotherlarge
485 489
486 490 $ hg log -G anotherlarge
487 491 @ changeset: 1:9627a577c5e9
488 492 | tag: tip
489 493 ~ user: test
490 494 date: Thu Jan 01 00:00:00 1970 +0000
491 495 summary: anotherlarge
492 496
493 497
494 498 $ hg log glob:another*
495 499 changeset: 1:9627a577c5e9
496 500 tag: tip
497 501 user: test
498 502 date: Thu Jan 01 00:00:00 1970 +0000
499 503 summary: anotherlarge
500 504
501 505 $ hg --debug log -T '{rev}: {desc}\n' -G glob:another*
502 506 updated patterns: glob:../.hglf/sub/another*, glob:another*
503 507 @ 1: anotherlarge
504 508 |
505 509 ~
506 510
507 511 #if no-msys
508 512 $ hg --debug log -T '{rev}: {desc}\n' 'glob:../.hglf/sub/another*' # no-msys
509 513 updated patterns: glob:../.hglf/sub/another*
510 514 1: anotherlarge
511 515
512 516 $ hg --debug log -G -T '{rev}: {desc}\n' 'glob:../.hglf/sub/another*' # no-msys
513 517 updated patterns: glob:../.hglf/sub/another*
514 518 @ 1: anotherlarge
515 519 |
516 520 ~
517 521 #endif
518 522
519 523 $ echo more >> anotherlarge
520 524 $ hg st .
521 525 M anotherlarge
522 526 $ hg cat anotherlarge
523 527 anotherlarge
524 528 $ hg revert anotherlarge
525 529 $ hg st
526 530 ? sub/anotherlarge.orig
527 531
528 532 Test orig files go where we want them
529 533 $ echo moremore >> anotherlarge
530 534 $ hg revert anotherlarge -v --config 'ui.origbackuppath=.hg/origbackups'
531 535 creating directory: $TESTTMP/addrm2/.hg/origbackups/.hglf/sub (glob)
532 536 saving current version of ../.hglf/sub/anotherlarge as $TESTTMP/addrm2/.hg/origbackups/.hglf/sub/anotherlarge (glob)
533 537 reverting ../.hglf/sub/anotherlarge (glob)
534 538 creating directory: $TESTTMP/addrm2/.hg/origbackups/sub (glob)
535 539 found 90c622cf65cebe75c5842f9136c459333faf392e in store
536 540 found 90c622cf65cebe75c5842f9136c459333faf392e in store
537 541 $ ls ../.hg/origbackups/sub
538 542 anotherlarge
539 543 $ cd ..
540 544
541 545 Test glob logging from the root dir
542 546 $ hg log glob:**another*
543 547 changeset: 1:9627a577c5e9
544 548 tag: tip
545 549 user: test
546 550 date: Thu Jan 01 00:00:00 1970 +0000
547 551 summary: anotherlarge
548 552
549 553 $ hg log -G glob:**another*
550 554 @ changeset: 1:9627a577c5e9
551 555 | tag: tip
552 556 ~ user: test
553 557 date: Thu Jan 01 00:00:00 1970 +0000
554 558 summary: anotherlarge
555 559
556 560
557 561 $ cd ..
558 562
559 563 Log from outer space
560 564 $ hg --debug log -R addrm2 -T '{rev}: {desc}\n' 'addrm2/sub/anotherlarge'
561 565 updated patterns: addrm2/.hglf/sub/anotherlarge, addrm2/sub/anotherlarge
562 566 1: anotherlarge
563 567 $ hg --debug log -R addrm2 -T '{rev}: {desc}\n' 'addrm2/.hglf/sub/anotherlarge'
564 568 updated patterns: addrm2/.hglf/sub/anotherlarge
565 569 1: anotherlarge
566 570
567 571
568 572 Check error message while exchange
569 573 =========================================================
570 574
571 575 issue3651: summary/outgoing with largefiles shows "no remote repo"
572 576 unexpectedly
573 577
574 578 $ mkdir issue3651
575 579 $ cd issue3651
576 580
577 581 $ hg init src
578 582 $ echo a > src/a
579 583 $ hg -R src add --large src/a
580 584 $ hg -R src commit -m '#0'
581 585 Invoking status precommit hook
582 586 A a
583 587
584 588 check messages when no remote repository is specified:
585 589 "no remote repo" route for "hg outgoing --large" is not tested here,
586 590 because it can't be reproduced easily.
587 591
588 592 $ hg init clone1
589 593 $ hg -R clone1 -q pull src
590 594 $ hg -R clone1 -q update
591 595 $ hg -R clone1 paths | grep default
592 596 [1]
593 597
594 598 $ hg -R clone1 summary --large
595 599 parent: 0:fc0bd45326d3 tip
596 600 #0
597 601 branch: default
598 602 commit: (clean)
599 603 update: (current)
600 604 phases: 1 draft
601 605 largefiles: (no remote repo)
602 606
603 607 check messages when there is no files to upload:
604 608
605 609 $ hg -q clone src clone2
606 610 $ hg -R clone2 paths | grep default
607 611 default = $TESTTMP/issue3651/src (glob)
608 612
609 613 $ hg -R clone2 summary --large
610 614 parent: 0:fc0bd45326d3 tip
611 615 #0
612 616 branch: default
613 617 commit: (clean)
614 618 update: (current)
615 619 phases: 1 draft
616 620 largefiles: (no files to upload)
617 621 $ hg -R clone2 outgoing --large
618 622 comparing with $TESTTMP/issue3651/src (glob)
619 623 searching for changes
620 624 no changes found
621 625 largefiles: no files to upload
622 626 [1]
623 627
624 628 $ hg -R clone2 outgoing --large --graph --template "{rev}"
625 629 comparing with $TESTTMP/issue3651/src (glob)
626 630 searching for changes
627 631 no changes found
628 632 largefiles: no files to upload
629 633
630 634 check messages when there are files to upload:
631 635
632 636 $ echo b > clone2/b
633 637 $ hg -R clone2 add --large clone2/b
634 638 $ hg -R clone2 commit -m '#1'
635 639 Invoking status precommit hook
636 640 A b
637 641 $ hg -R clone2 summary --large
638 642 parent: 1:1acbe71ce432 tip
639 643 #1
640 644 branch: default
641 645 commit: (clean)
642 646 update: (current)
643 647 phases: 2 draft
644 648 largefiles: 1 entities for 1 files to upload
645 649 $ hg -R clone2 outgoing --large
646 650 comparing with $TESTTMP/issue3651/src (glob)
647 651 searching for changes
648 652 changeset: 1:1acbe71ce432
649 653 tag: tip
650 654 user: test
651 655 date: Thu Jan 01 00:00:00 1970 +0000
652 656 summary: #1
653 657
654 658 largefiles to upload (1 entities):
655 659 b
656 660
657 661 $ hg -R clone2 outgoing --large --graph --template "{rev}"
658 662 comparing with $TESTTMP/issue3651/src (glob)
659 663 searching for changes
660 664 @ 1
661 665
662 666 largefiles to upload (1 entities):
663 667 b
664 668
665 669
666 670 $ cp clone2/b clone2/b1
667 671 $ cp clone2/b clone2/b2
668 672 $ hg -R clone2 add --large clone2/b1 clone2/b2
669 673 $ hg -R clone2 commit -m '#2: add largefiles referring same entity'
670 674 Invoking status precommit hook
671 675 A b1
672 676 A b2
673 677 $ hg -R clone2 summary --large
674 678 parent: 2:6095d0695d70 tip
675 679 #2: add largefiles referring same entity
676 680 branch: default
677 681 commit: (clean)
678 682 update: (current)
679 683 phases: 3 draft
680 684 largefiles: 1 entities for 3 files to upload
681 685 $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n"
682 686 comparing with $TESTTMP/issue3651/src (glob)
683 687 searching for changes
684 688 1:1acbe71ce432
685 689 2:6095d0695d70
686 690 largefiles to upload (1 entities):
687 691 b
688 692 b1
689 693 b2
690 694
691 695 $ hg -R clone2 cat -r 1 clone2/.hglf/b
692 696 89e6c98d92887913cadf06b2adb97f26cde4849b
693 697 $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n" --debug --config progress.debug=true
694 698 comparing with $TESTTMP/issue3651/src (glob)
695 699 query 1; heads
696 700 searching for changes
697 701 all remote heads known locally
698 702 1:1acbe71ce432
699 703 2:6095d0695d70
700 704 finding outgoing largefiles: 0/2 revisions (0.00%)
701 705 finding outgoing largefiles: 1/2 revisions (50.00%)
702 706 largefiles to upload (1 entities):
703 707 b
704 708 89e6c98d92887913cadf06b2adb97f26cde4849b
705 709 b1
706 710 89e6c98d92887913cadf06b2adb97f26cde4849b
707 711 b2
708 712 89e6c98d92887913cadf06b2adb97f26cde4849b
709 713
710 714
711 715 $ echo bbb > clone2/b
712 716 $ hg -R clone2 commit -m '#3: add new largefile entity as existing file'
713 717 Invoking status precommit hook
714 718 M b
715 719 $ echo bbbb > clone2/b
716 720 $ hg -R clone2 commit -m '#4: add new largefile entity as existing file'
717 721 Invoking status precommit hook
718 722 M b
719 723 $ cp clone2/b1 clone2/b
720 724 $ hg -R clone2 commit -m '#5: refer existing largefile entity again'
721 725 Invoking status precommit hook
722 726 M b
723 727 $ hg -R clone2 summary --large
724 728 parent: 5:036794ea641c tip
725 729 #5: refer existing largefile entity again
726 730 branch: default
727 731 commit: (clean)
728 732 update: (current)
729 733 phases: 6 draft
730 734 largefiles: 3 entities for 3 files to upload
731 735 $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n"
732 736 comparing with $TESTTMP/issue3651/src (glob)
733 737 searching for changes
734 738 1:1acbe71ce432
735 739 2:6095d0695d70
736 740 3:7983dce246cc
737 741 4:233f12ada4ae
738 742 5:036794ea641c
739 743 largefiles to upload (3 entities):
740 744 b
741 745 b1
742 746 b2
743 747
744 748 $ hg -R clone2 cat -r 3 clone2/.hglf/b
745 749 c801c9cfe94400963fcb683246217d5db77f9a9a
746 750 $ hg -R clone2 cat -r 4 clone2/.hglf/b
747 751 13f9ed0898e315bf59dc2973fec52037b6f441a2
748 752 $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n" --debug --config progress.debug=true
749 753 comparing with $TESTTMP/issue3651/src (glob)
750 754 query 1; heads
751 755 searching for changes
752 756 all remote heads known locally
753 757 1:1acbe71ce432
754 758 2:6095d0695d70
755 759 3:7983dce246cc
756 760 4:233f12ada4ae
757 761 5:036794ea641c
758 762 finding outgoing largefiles: 0/5 revisions (0.00%)
759 763 finding outgoing largefiles: 1/5 revisions (20.00%)
760 764 finding outgoing largefiles: 2/5 revisions (40.00%)
761 765 finding outgoing largefiles: 3/5 revisions (60.00%)
762 766 finding outgoing largefiles: 4/5 revisions (80.00%)
763 767 largefiles to upload (3 entities):
764 768 b
765 769 13f9ed0898e315bf59dc2973fec52037b6f441a2
766 770 89e6c98d92887913cadf06b2adb97f26cde4849b
767 771 c801c9cfe94400963fcb683246217d5db77f9a9a
768 772 b1
769 773 89e6c98d92887913cadf06b2adb97f26cde4849b
770 774 b2
771 775 89e6c98d92887913cadf06b2adb97f26cde4849b
772 776
773 777
774 778 Pushing revision #1 causes uploading entity 89e6c98d9288, which is
775 779 shared also by largefiles b1, b2 in revision #2 and b in revision #5.
776 780
777 781 Then, entity 89e6c98d9288 is not treated as "outgoing entity" at "hg
778 782 summary" and "hg outgoing", even though files in outgoing revision #2
779 783 and #5 refer it.
780 784
781 785 $ hg -R clone2 push -r 1 -q
782 786 $ hg -R clone2 summary --large
783 787 parent: 5:036794ea641c tip
784 788 #5: refer existing largefile entity again
785 789 branch: default
786 790 commit: (clean)
787 791 update: (current)
788 792 phases: 6 draft
789 793 largefiles: 2 entities for 1 files to upload
790 794 $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n"
791 795 comparing with $TESTTMP/issue3651/src (glob)
792 796 searching for changes
793 797 2:6095d0695d70
794 798 3:7983dce246cc
795 799 4:233f12ada4ae
796 800 5:036794ea641c
797 801 largefiles to upload (2 entities):
798 802 b
799 803
800 804 $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n" --debug --config progress.debug=true
801 805 comparing with $TESTTMP/issue3651/src (glob)
802 806 query 1; heads
803 807 searching for changes
804 808 all remote heads known locally
805 809 2:6095d0695d70
806 810 3:7983dce246cc
807 811 4:233f12ada4ae
808 812 5:036794ea641c
809 813 finding outgoing largefiles: 0/4 revisions (0.00%)
810 814 finding outgoing largefiles: 1/4 revisions (25.00%)
811 815 finding outgoing largefiles: 2/4 revisions (50.00%)
812 816 finding outgoing largefiles: 3/4 revisions (75.00%)
813 817 largefiles to upload (2 entities):
814 818 b
815 819 13f9ed0898e315bf59dc2973fec52037b6f441a2
816 820 c801c9cfe94400963fcb683246217d5db77f9a9a
817 821
818 822
819 823 $ cd ..
820 824
821 825 merge action 'd' for 'local renamed directory to d2/g' which has no filename
822 826 ==================================================================================
823 827
824 828 $ hg init merge-action
825 829 $ cd merge-action
826 830 $ touch l
827 831 $ hg add --large l
828 832 $ mkdir d1
829 833 $ touch d1/f
830 834 $ hg ci -Aqm0
831 835 Invoking status precommit hook
832 836 A d1/f
833 837 A l
834 838 $ echo > d1/f
835 839 $ touch d1/g
836 840 $ hg ci -Aqm1
837 841 Invoking status precommit hook
838 842 M d1/f
839 843 A d1/g
840 844 $ hg up -qr0
841 845 $ hg mv d1 d2
842 846 moving d1/f to d2/f (glob)
843 847 $ hg ci -qm2
844 848 Invoking status precommit hook
845 849 A d2/f
846 850 R d1/f
847 851 $ hg merge
848 852 merging d2/f and d1/f to d2/f
849 853 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
850 854 (branch merge, don't forget to commit)
851 855 $ cd ..
852 856
853 857
854 858 Merge conflicts:
855 859 =====================
856 860
857 861 $ hg init merge
858 862 $ cd merge
859 863 $ echo 0 > f-different
860 864 $ echo 0 > f-same
861 865 $ echo 0 > f-unchanged-1
862 866 $ echo 0 > f-unchanged-2
863 867 $ hg add --large *
864 868 $ hg ci -m0
865 869 Invoking status precommit hook
866 870 A f-different
867 871 A f-same
868 872 A f-unchanged-1
869 873 A f-unchanged-2
870 874 $ echo tmp1 > f-unchanged-1
871 875 $ echo tmp1 > f-unchanged-2
872 876 $ echo tmp1 > f-same
873 877 $ hg ci -m1
874 878 Invoking status precommit hook
875 879 M f-same
876 880 M f-unchanged-1
877 881 M f-unchanged-2
878 882 $ echo 2 > f-different
879 883 $ echo 0 > f-unchanged-1
880 884 $ echo 1 > f-unchanged-2
881 885 $ echo 1 > f-same
882 886 $ hg ci -m2
883 887 Invoking status precommit hook
884 888 M f-different
885 889 M f-same
886 890 M f-unchanged-1
887 891 M f-unchanged-2
888 892 $ hg up -qr0
889 893 $ echo tmp2 > f-unchanged-1
890 894 $ echo tmp2 > f-unchanged-2
891 895 $ echo tmp2 > f-same
892 896 $ hg ci -m3
893 897 Invoking status precommit hook
894 898 M f-same
895 899 M f-unchanged-1
896 900 M f-unchanged-2
897 901 created new head
898 902 $ echo 1 > f-different
899 903 $ echo 1 > f-unchanged-1
900 904 $ echo 0 > f-unchanged-2
901 905 $ echo 1 > f-same
902 906 $ hg ci -m4
903 907 Invoking status precommit hook
904 908 M f-different
905 909 M f-same
906 910 M f-unchanged-1
907 911 M f-unchanged-2
908 912 $ hg merge
909 913 largefile f-different has a merge conflict
910 914 ancestor was 09d2af8dd22201dd8d48e5dcfcaed281ff9422c7
911 915 keep (l)ocal e5fa44f2b31c1fb553b6021e7360d07d5d91ff5e or
912 916 take (o)ther 7448d8798a4380162d4b56f9b452e2f6f9e24e7a? l
913 917 getting changed largefiles
914 918 1 largefiles updated, 0 removed
915 919 0 files updated, 4 files merged, 0 files removed, 0 files unresolved
916 920 (branch merge, don't forget to commit)
917 921 $ cat f-different
918 922 1
919 923 $ cat f-same
920 924 1
921 925 $ cat f-unchanged-1
922 926 1
923 927 $ cat f-unchanged-2
924 928 1
925 929 $ cd ..
926 930
927 931 Test largefile insulation (do not enabled a side effect
928 932 ========================================================
929 933
930 934 Check whether "largefiles" feature is supported only in repositories
931 935 enabling largefiles extension.
932 936
933 937 $ mkdir individualenabling
934 938 $ cd individualenabling
935 939
936 940 $ hg init enabledlocally
937 941 $ echo large > enabledlocally/large
938 942 $ hg -R enabledlocally add --large enabledlocally/large
939 943 $ hg -R enabledlocally commit -m '#0'
940 944 Invoking status precommit hook
941 945 A large
942 946
943 947 $ hg init notenabledlocally
944 948 $ echo large > notenabledlocally/large
945 949 $ hg -R notenabledlocally add --large notenabledlocally/large
946 950 $ hg -R notenabledlocally commit -m '#0'
947 951 Invoking status precommit hook
948 952 A large
949 953
950 954 $ cat >> $HGRCPATH <<EOF
951 955 > [extensions]
952 956 > # disable globally
953 957 > largefiles=!
954 958 > EOF
955 959 $ cat >> enabledlocally/.hg/hgrc <<EOF
956 960 > [extensions]
957 961 > # enable locally
958 962 > largefiles=
959 963 > EOF
960 964 $ hg -R enabledlocally root
961 965 $TESTTMP/individualenabling/enabledlocally (glob)
962 966 $ hg -R notenabledlocally root
963 967 abort: repository requires features unknown to this Mercurial: largefiles!
964 968 (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
965 969 [255]
966 970
967 971 $ hg init push-dst
968 972 $ hg -R enabledlocally push push-dst
969 973 pushing to push-dst
970 974 abort: required features are not supported in the destination: largefiles
971 975 [255]
972 976
973 977 $ hg init pull-src
974 978 $ hg -R pull-src pull enabledlocally
975 979 pulling from enabledlocally
976 980 abort: required features are not supported in the destination: largefiles
977 981 [255]
978 982
979 983 $ hg clone enabledlocally clone-dst
980 984 abort: repository requires features unknown to this Mercurial: largefiles!
981 985 (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
982 986 [255]
983 987 $ test -d clone-dst
984 988 [1]
985 989 $ hg clone --pull enabledlocally clone-pull-dst
986 990 abort: required features are not supported in the destination: largefiles
987 991 [255]
988 992 $ test -d clone-pull-dst
989 993 [1]
990 994
991 995 #if serve
992 996
993 997 Test largefiles specific peer setup, when largefiles is enabled
994 998 locally (issue4109)
995 999
996 1000 $ hg showconfig extensions | grep largefiles
997 1001 extensions.largefiles=!
998 1002 $ mkdir -p $TESTTMP/individualenabling/usercache
999 1003
1000 1004 $ hg serve -R enabledlocally -d -p $HGPORT --pid-file hg.pid
1001 1005 $ cat hg.pid >> $DAEMON_PIDS
1002 1006
1003 1007 $ hg init pull-dst
1004 1008 $ cat > pull-dst/.hg/hgrc <<EOF
1005 1009 > [extensions]
1006 1010 > # enable locally
1007 1011 > largefiles=
1008 1012 > [largefiles]
1009 1013 > # ignore system cache to force largefiles specific wire proto access
1010 1014 > usercache=$TESTTMP/individualenabling/usercache
1011 1015 > EOF
1012 1016 $ hg -R pull-dst -q pull -u http://localhost:$HGPORT
1013 1017
1014 1018 $ killdaemons.py
1015 1019 #endif
1016 1020
1017 1021 Test overridden functions work correctly even for repos disabling
1018 1022 largefiles (issue4547)
1019 1023
1020 1024 $ hg showconfig extensions | grep largefiles
1021 1025 extensions.largefiles=!
1022 1026
1023 1027 (test updating implied by clone)
1024 1028
1025 1029 $ hg init enabled-but-no-largefiles
1026 1030 $ echo normal1 > enabled-but-no-largefiles/normal1
1027 1031 $ hg -R enabled-but-no-largefiles add enabled-but-no-largefiles/normal1
1028 1032 $ hg -R enabled-but-no-largefiles commit -m '#0@enabled-but-no-largefiles'
1029 1033 Invoking status precommit hook
1030 1034 A normal1
1031 1035 $ cat >> enabled-but-no-largefiles/.hg/hgrc <<EOF
1032 1036 > [extensions]
1033 1037 > # enable locally
1034 1038 > largefiles=
1035 1039 > EOF
1036 1040 $ hg clone -q enabled-but-no-largefiles no-largefiles
1037 1041
1038 1042 $ echo normal2 > enabled-but-no-largefiles/normal2
1039 1043 $ hg -R enabled-but-no-largefiles add enabled-but-no-largefiles/normal2
1040 1044 $ hg -R enabled-but-no-largefiles commit -m '#1@enabled-but-no-largefiles'
1041 1045 Invoking status precommit hook
1042 1046 A normal2
1043 1047
1044 1048 $ echo normal3 > no-largefiles/normal3
1045 1049 $ hg -R no-largefiles add no-largefiles/normal3
1046 1050 $ hg -R no-largefiles commit -m '#1@no-largefiles'
1047 1051 Invoking status precommit hook
1048 1052 A normal3
1049 1053
1050 1054 $ hg -R no-largefiles -q pull --rebase
1051 1055 Invoking status precommit hook
1052 1056 A normal3
1053 1057
1054 1058 (test reverting)
1055 1059
1056 1060 $ hg init subrepo-root
1057 1061 $ cat >> subrepo-root/.hg/hgrc <<EOF
1058 1062 > [extensions]
1059 1063 > # enable locally
1060 1064 > largefiles=
1061 1065 > EOF
1062 1066 $ echo large > subrepo-root/large
1063 $ hg -R subrepo-root add --large subrepo-root/large
1067 $ mkdir -p subrepo-root/dir/subdir
1068 $ echo large2 > subrepo-root/dir/subdir/large.bin
1069 $ hg -R subrepo-root add --large subrepo-root/large subrepo-root/dir/subdir/large.bin
1064 1070 $ hg clone -q no-largefiles subrepo-root/no-largefiles
1065 1071 $ cat > subrepo-root/.hgsub <<EOF
1066 1072 > no-largefiles = no-largefiles
1067 1073 > EOF
1068 1074 $ hg -R subrepo-root add subrepo-root/.hgsub
1069 1075 $ hg -R subrepo-root commit -m '#0'
1070 1076 Invoking status precommit hook
1071 1077 A .hgsub
1078 A dir/subdir/large.bin
1072 1079 A large
1073 1080 ? .hgsubstate
1074 1081 $ echo dirty >> subrepo-root/large
1075 1082 $ echo dirty >> subrepo-root/no-largefiles/normal1
1076 1083 $ hg -R subrepo-root status -S
1077 1084 M large
1078 1085 M no-largefiles/normal1
1079 1086 $ hg -R subrepo-root extdiff -p echo -S --config extensions.extdiff=
1080 1087 "*\\no-largefiles\\normal1" "*\\no-largefiles\\normal1" (glob) (windows !)
1081 1088 */no-largefiles/normal1 */no-largefiles/normal1 (glob) (no-windows !)
1082 1089 [1]
1083 1090 $ hg -R subrepo-root revert --all
1084 1091 reverting subrepo-root/.hglf/large (glob)
1085 1092 reverting subrepo no-largefiles
1086 1093 reverting subrepo-root/no-largefiles/normal1 (glob)
1087 1094
1088 $ cd ..
1095 Move (and then undo) a directory move with only largefiles.
1096
1097 $ listtree() {
1098 > find $@ \( -type d -printf "%p/\n" -o -type f -printf "%p\n" \) \
1099 > -a -name .hg -prune | sort
1100 > }
1101
1102 $ cd subrepo-root
1103 $ listtree .hglf dir* large*
1104 .hglf/
1105 .hglf/dir/
1106 .hglf/dir/subdir/
1107 .hglf/dir/subdir/large.bin
1108 .hglf/large
1109 dir/
1110 dir/subdir/
1111 dir/subdir/large.bin
1112 large
1113 large.orig
1114
1115 $ hg mv dir/subdir dir/subdir2
1116 moving .hglf/dir/subdir/large.bin to .hglf/dir/subdir2/large.bin (glob)
1117
1118 $ listtree .hglf dir* large*
1119 .hglf/
1120 .hglf/dir/
1121 .hglf/dir/subdir2/
1122 .hglf/dir/subdir2/large.bin
1123 .hglf/large
1124 dir/
1125 dir/subdir2/
1126 dir/subdir2/large.bin
1127 large
1128 large.orig
1129 $ hg status -C
1130 A dir/subdir2/large.bin
1131 dir/subdir/large.bin
1132 R dir/subdir/large.bin
1133 ? large.orig
1134
1135 $ echo 'modified' > dir/subdir2/large.bin
1136 $ hg status -C
1137 A dir/subdir2/large.bin
1138 dir/subdir/large.bin
1139 R dir/subdir/large.bin
1140 ? large.orig
1141
1142 $ hg revert --all
1143 undeleting .hglf/dir/subdir/large.bin (glob)
1144 forgetting .hglf/dir/subdir2/large.bin (glob)
1145 reverting subrepo no-largefiles
1146
1147 $ hg status -C
1148 ? dir/subdir2/large.bin
1149 ? large.orig
1150
1151 BUG: The content of the forgotten file shouldn't be clobbered
1152
1153 $ cat dir/subdir2/large.bin
1154 large2
1155
1156 BUG: the standin for subdir2 should be deleted, not just dropped
1157
1158 $ listtree .hglf dir* large*
1159 .hglf/
1160 .hglf/dir/
1161 .hglf/dir/subdir/
1162 .hglf/dir/subdir/large.bin
1163 .hglf/dir/subdir2/
1164 .hglf/dir/subdir2/large.bin
1165 .hglf/large
1166 dir/
1167 dir/subdir/
1168 dir/subdir/large.bin
1169 dir/subdir2/
1170 dir/subdir2/large.bin
1171 large
1172 large.orig
1089 1173
1174 $ rm -r dir/subdir2
1175
1176 BUG: subdir should not be in the destination. This is caused by the directory
1177 existing under .hglf/.
1178 $ hg mv dir/subdir dir/subdir2
1179 moving .hglf/dir/subdir/large.bin to .hglf/dir/subdir2/subdir/large.bin (glob)
1180
1181 $ hg status -C
1182 A dir/subdir2/subdir/large.bin
1183 dir/subdir/large.bin
1184 R dir/subdir/large.bin
1185 ? large.orig
1186
1187 $ listtree .hglf dir* large*
1188 .hglf/
1189 .hglf/dir/
1190 .hglf/dir/subdir2/
1191 .hglf/dir/subdir2/large.bin
1192 .hglf/dir/subdir2/subdir/
1193 .hglf/dir/subdir2/subdir/large.bin
1194 .hglf/large
1195 dir/
1196 dir/subdir2/
1197 dir/subdir2/subdir/
1198 dir/subdir2/subdir/large.bin
1199 large
1200 large.orig
1201
1202 Start from scratch, and rename something other than the final path component.
1203
1204 $ hg up -qC .
1205 $ hg --config extensions.purge= purge
1206
1207 $ hg mv dir/subdir dir2/subdir
1208 moving .hglf/dir/subdir/large.bin to .hglf/dir2/subdir/large.bin (glob)
1209
1210 $ hg status -C
1211 A dir2/subdir/large.bin
1212 dir/subdir/large.bin
1213 R dir/subdir/large.bin
1214
1215 $ listtree .hglf dir* large*
1216 .hglf/
1217 .hglf/dir2/
1218 .hglf/dir2/subdir/
1219 .hglf/dir2/subdir/large.bin
1220 .hglf/large
1221 dir2/
1222 dir2/subdir/
1223 dir2/subdir/large.bin
1224 large
1225
1226 $ hg revert --all
1227 undeleting .hglf/dir/subdir/large.bin (glob)
1228 forgetting .hglf/dir2/subdir/large.bin (glob)
1229 reverting subrepo no-largefiles
1230
1231 $ hg status -C
1232 ? dir2/subdir/large.bin
1233
1234 $ listtree .hglf dir* large*
1235 .hglf/
1236 .hglf/dir/
1237 .hglf/dir/subdir/
1238 .hglf/dir/subdir/large.bin
1239 .hglf/dir2/
1240 .hglf/dir2/subdir/
1241 .hglf/dir2/subdir/large.bin
1242 .hglf/large
1243 dir/
1244 dir/subdir/
1245 dir/subdir/large.bin
1246 dir2/
1247 dir2/subdir/
1248 dir2/subdir/large.bin
1249 large
1250
1251 $ cd ../..
1090 1252
1091 1253 Test "pull --rebase" when rebase is enabled before largefiles (issue3861)
1092 1254 =========================================================================
1093 1255
1094 1256 $ hg showconfig extensions | grep largefiles
1095 1257 extensions.largefiles=!
1096 1258
1097 1259 $ mkdir issue3861
1098 1260 $ cd issue3861
1099 1261 $ hg init src
1100 1262 $ hg clone -q src dst
1101 1263 $ echo a > src/a
1102 1264 $ hg -R src commit -Aqm "#0"
1103 1265 Invoking status precommit hook
1104 1266 A a
1105 1267
1106 1268 $ cat >> dst/.hg/hgrc <<EOF
1107 1269 > [extensions]
1108 1270 > largefiles=
1109 1271 > EOF
1110 1272 $ hg -R dst pull --rebase
1111 1273 pulling from $TESTTMP/issue3861/src (glob)
1112 1274 requesting all changes
1113 1275 adding changesets
1114 1276 adding manifests
1115 1277 adding file changes
1116 1278 added 1 changesets with 1 changes to 1 files
1117 1279 new changesets bf5e395ced2c
1118 1280 nothing to rebase - updating instead
1119 1281 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1120 1282
1121 1283 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now