##// END OF EJS Templates
test-import: workaround for missing newline is no longer needed
Mads Kiilerich -
r12945:99f7dc8d default
parent child Browse files
Show More
@@ -1,931 +1,931
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
14 14 import exported patch
15 15
16 16 $ hg clone -r0 a b
17 17 adding changesets
18 18 adding manifests
19 19 adding file changes
20 20 added 1 changesets with 2 changes to 2 files
21 21 updating to branch default
22 22 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
23 23 $ hg --cwd a export tip > tip.patch
24 24 $ hg --cwd b import ../tip.patch
25 25 applying ../tip.patch
26 26
27 27 message should be same
28 28
29 29 $ hg --cwd b tip | grep 'second change'
30 30 summary: second change
31 31
32 32 committer should be same
33 33
34 34 $ hg --cwd b tip | grep someone
35 35 user: someone
36 36 $ rm -r b
37 37
38 38
39 39 import exported patch with external patcher
40 40
41 41 $ cat > dummypatch.py <<EOF
42 42 > print 'patching file a'
43 43 > file('a', 'wb').write('line2\n')
44 44 > EOF
45 45 $ chmod +x dummypatch.py
46 46 $ hg clone -r0 a b
47 47 adding changesets
48 48 adding manifests
49 49 adding file changes
50 50 added 1 changesets with 2 changes to 2 files
51 51 updating to branch default
52 52 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
53 53 $ hg --cwd a export tip > tip.patch
54 54 $ hg --config ui.patch='python ../dummypatch.py' --cwd b import ../tip.patch
55 55 applying ../tip.patch
56 56 $ cat b/a
57 57 line2
58 58 $ rm -r b
59 59
60 60
61 61 import of plain diff should fail without message
62 62
63 63 $ hg clone -r0 a b
64 64 adding changesets
65 65 adding manifests
66 66 adding file changes
67 67 added 1 changesets with 2 changes to 2 files
68 68 updating to branch default
69 69 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
70 70 $ hg --cwd a diff -r0:1 > tip.patch
71 71 $ hg --cwd b import ../tip.patch
72 72 applying ../tip.patch
73 73 abort: empty commit message
74 74 [255]
75 75 $ rm -r b
76 76
77 77
78 78 import of plain diff should be ok with message
79 79
80 80 $ hg clone -r0 a b
81 81 adding changesets
82 82 adding manifests
83 83 adding file changes
84 84 added 1 changesets with 2 changes to 2 files
85 85 updating to branch default
86 86 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
87 87 $ hg --cwd a diff -r0:1 > tip.patch
88 88 $ hg --cwd b import -mpatch ../tip.patch
89 89 applying ../tip.patch
90 90 $ rm -r b
91 91
92 92
93 93 import of plain diff with specific date and user
94 94
95 95 $ hg clone -r0 a b
96 96 adding changesets
97 97 adding manifests
98 98 adding file changes
99 99 added 1 changesets with 2 changes to 2 files
100 100 updating to branch default
101 101 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
102 102 $ hg --cwd a diff -r0:1 > tip.patch
103 103 $ hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../tip.patch
104 104 applying ../tip.patch
105 105 $ hg -R b tip -pv
106 106 changeset: 1:ca68f19f3a40
107 107 tag: tip
108 108 user: user@nowhere.net
109 109 date: Thu Jan 01 00:00:01 1970 +0000
110 110 files: a
111 111 description:
112 112 patch
113 113
114 114
115 115 diff -r 80971e65b431 -r ca68f19f3a40 a
116 116 --- a/a Thu Jan 01 00:00:00 1970 +0000
117 117 +++ b/a Thu Jan 01 00:00:01 1970 +0000
118 118 @@ -1,1 +1,2 @@
119 119 line 1
120 120 +line 2
121 121
122 122 $ rm -r b
123 123
124 124
125 125 import of plain diff should be ok with --no-commit
126 126
127 127 $ hg clone -r0 a b
128 128 adding changesets
129 129 adding manifests
130 130 adding file changes
131 131 added 1 changesets with 2 changes to 2 files
132 132 updating to branch default
133 133 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
134 134 $ hg --cwd a diff -r0:1 > tip.patch
135 135 $ hg --cwd b import --no-commit ../tip.patch
136 136 applying ../tip.patch
137 137 $ hg --cwd b diff --nodates
138 138 diff -r 80971e65b431 a
139 139 --- a/a
140 140 +++ b/a
141 141 @@ -1,1 +1,2 @@
142 142 line 1
143 143 +line 2
144 144 $ rm -r b
145 145
146 146
147 147 import of malformed plain diff should fail
148 148
149 149 $ hg clone -r0 a b
150 150 adding changesets
151 151 adding manifests
152 152 adding file changes
153 153 added 1 changesets with 2 changes to 2 files
154 154 updating to branch default
155 155 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
156 156 $ hg --cwd a diff -r0:1 > tip.patch
157 157 $ sed 's/1,1/foo/' < tip.patch > broken.patch
158 158 $ hg --cwd b import -mpatch ../broken.patch
159 159 applying ../broken.patch
160 160 abort: bad hunk #1
161 161 [255]
162 162 $ rm -r b
163 163
164 164
165 165 hg -R repo import
166 166 put the clone in a subdir - having a directory named "a"
167 167 used to hide a bug.
168 168
169 169 $ mkdir dir
170 170 $ hg clone -r0 a dir/b
171 171 adding changesets
172 172 adding manifests
173 173 adding file changes
174 174 added 1 changesets with 2 changes to 2 files
175 175 updating to branch default
176 176 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
177 177 $ hg --cwd a export tip > dir/tip.patch
178 178 $ cd dir
179 179 $ hg -R b import tip.patch
180 180 applying tip.patch
181 181 $ cd ..
182 182 $ rm -r dir
183 183
184 184
185 185 import from stdin
186 186
187 187 $ hg clone -r0 a b
188 188 adding changesets
189 189 adding manifests
190 190 adding file changes
191 191 added 1 changesets with 2 changes to 2 files
192 192 updating to branch default
193 193 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
194 194 $ hg --cwd a export tip | hg --cwd b import -
195 195 applying patch from stdin
196 196 $ rm -r b
197 197
198 198
199 199 import two patches in one stream
200 200
201 201 $ hg init b
202 202 $ hg --cwd a export 0:tip | hg --cwd b import -
203 203 applying patch from stdin
204 204 applied 80971e65b431
205 205 $ hg --cwd a id
206 206 1d4bd90af0e4 tip
207 207 $ hg --cwd b id
208 208 1d4bd90af0e4 tip
209 209 $ rm -r b
210 210
211 211
212 212 override commit message
213 213
214 214 $ hg clone -r0 a b
215 215 adding changesets
216 216 adding manifests
217 217 adding file changes
218 218 added 1 changesets with 2 changes to 2 files
219 219 updating to branch default
220 220 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
221 221 $ hg --cwd a export tip | hg --cwd b import -m 'override' -
222 222 applying patch from stdin
223 223 $ hg --cwd b tip | grep override
224 224 summary: override
225 225 $ rm -r b
226 226
227 227 $ cat > mkmsg.py <<EOF
228 228 > import email.Message, sys
229 229 > msg = email.Message.Message()
230 230 > msg.set_payload('email commit message\n' + open('tip.patch', 'rb').read())
231 231 > msg['Subject'] = 'email patch'
232 232 > msg['From'] = 'email patcher'
233 233 > sys.stdout.write(msg.as_string())
234 234 > EOF
235 235
236 236
237 237 plain diff in email, subject, message body
238 238
239 239 $ hg clone -r0 a b
240 240 adding changesets
241 241 adding manifests
242 242 adding file changes
243 243 added 1 changesets with 2 changes to 2 files
244 244 updating to branch default
245 245 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
246 246 $ hg --cwd a diff -r0:1 > tip.patch
247 247 $ python mkmsg.py > msg.patch
248 248 $ hg --cwd b import ../msg.patch
249 249 applying ../msg.patch
250 250 $ hg --cwd b tip | grep email
251 251 user: email patcher
252 252 summary: email patch
253 253 $ rm -r b
254 254
255 255
256 256 plain diff in email, no subject, message body
257 257
258 258 $ hg clone -r0 a b
259 259 adding changesets
260 260 adding manifests
261 261 adding file changes
262 262 added 1 changesets with 2 changes to 2 files
263 263 updating to branch default
264 264 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
265 265 $ grep -v '^Subject:' msg.patch | hg --cwd b import -
266 266 applying patch from stdin
267 267 $ rm -r b
268 268
269 269
270 270 plain diff in email, subject, no message body
271 271
272 272 $ hg clone -r0 a b
273 273 adding changesets
274 274 adding manifests
275 275 adding file changes
276 276 added 1 changesets with 2 changes to 2 files
277 277 updating to branch default
278 278 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
279 279 $ grep -v '^email ' msg.patch | hg --cwd b import -
280 280 applying patch from stdin
281 281 $ rm -r b
282 282
283 283
284 284 plain diff in email, no subject, no message body, should fail
285 285
286 286 $ hg clone -r0 a b
287 287 adding changesets
288 288 adding manifests
289 289 adding file changes
290 290 added 1 changesets with 2 changes to 2 files
291 291 updating to branch default
292 292 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
293 293 $ egrep -v '^(Subject|email)' msg.patch | hg --cwd b import -
294 294 applying patch from stdin
295 295 abort: empty commit message
296 296 [255]
297 297 $ rm -r b
298 298
299 299
300 300 hg export in email, should use patch header
301 301
302 302 $ hg clone -r0 a b
303 303 adding changesets
304 304 adding manifests
305 305 adding file changes
306 306 added 1 changesets with 2 changes to 2 files
307 307 updating to branch default
308 308 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
309 309 $ hg --cwd a export tip > tip.patch
310 310 $ python mkmsg.py | hg --cwd b import -
311 311 applying patch from stdin
312 312 $ hg --cwd b tip | grep second
313 313 summary: second change
314 314 $ rm -r b
315 315
316 316
317 317 subject: duplicate detection, removal of [PATCH]
318 318 The '---' tests the gitsendmail handling without proper mail headers
319 319
320 320 $ cat > mkmsg2.py <<EOF
321 321 > import email.Message, sys
322 322 > msg = email.Message.Message()
323 323 > msg.set_payload('email patch\n\nnext line\n---\n' + open('tip.patch').read())
324 324 > msg['Subject'] = '[PATCH] email patch'
325 325 > msg['From'] = 'email patcher'
326 326 > sys.stdout.write(msg.as_string())
327 327 > EOF
328 328
329 329
330 330 plain diff in email, [PATCH] subject, message body with subject
331 331
332 332 $ hg clone -r0 a b
333 333 adding changesets
334 334 adding manifests
335 335 adding file changes
336 336 added 1 changesets with 2 changes to 2 files
337 337 updating to branch default
338 338 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
339 339 $ hg --cwd a diff -r0:1 > tip.patch
340 340 $ python mkmsg2.py | hg --cwd b import -
341 341 applying patch from stdin
342 342 $ hg --cwd b tip --template '{desc}\n'
343 343 email patch
344 344
345 345 next line
346 346 ---
347 347 $ rm -r b
348 348
349 349
350 350 Issue963: Parent of working dir incorrect after import of multiple
351 351 patches and rollback
352 352
353 353 We weren't backing up the correct dirstate file when importing many
354 354 patches: import patch1 patch2; rollback
355 355
356 356 $ echo line 3 >> a/a
357 357 $ hg --cwd a ci -m'third change'
358 358 $ hg --cwd a export -o '../patch%R' 1 2
359 359 $ hg clone -qr0 a b
360 360 $ hg --cwd b parents --template 'parent: {rev}\n'
361 361 parent: 0
362 362 $ hg --cwd b import ../patch1 ../patch2
363 363 applying ../patch1
364 364 applying ../patch2
365 365 applied 1d4bd90af0e4
366 366 $ hg --cwd b rollback
367 367 rolling back to revision 1 (undo commit)
368 368 $ hg --cwd b parents --template 'parent: {rev}\n'
369 369 parent: 1
370 370 $ rm -r b
371 371
372 372
373 373 importing a patch in a subdirectory failed at the commit stage
374 374
375 375 $ echo line 2 >> a/d1/d2/a
376 376 $ hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change'
377 377
378 378 hg import in a subdirectory
379 379
380 380 $ hg clone -r0 a b
381 381 adding changesets
382 382 adding manifests
383 383 adding file changes
384 384 added 1 changesets with 2 changes to 2 files
385 385 updating to branch default
386 386 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
387 387 $ hg --cwd a export tip > tmp
388 388 $ sed -e 's/d1\/d2\///' < tmp > tip.patch
389 389 $ dir=`pwd`
390 390 $ cd b/d1/d2 2>&1 > /dev/null
391 391 $ hg import ../../../tip.patch
392 392 applying ../../../tip.patch
393 393 $ cd "$dir"
394 394
395 395 message should be 'subdir change'
396 396
397 397 $ hg --cwd b tip | grep 'subdir change'
398 398 summary: subdir change
399 399
400 400 committer should be 'someoneelse'
401 401
402 402 $ hg --cwd b tip | grep someoneelse
403 403 user: someoneelse
404 404
405 405 should be empty
406 406
407 407 $ hg --cwd b status
408 408
409 409
410 410 Test fuzziness (ambiguous patch location, fuzz=2)
411 411
412 412 $ hg init fuzzy
413 413 $ cd fuzzy
414 414 $ echo line1 > a
415 415 $ echo line0 >> a
416 416 $ echo line3 >> a
417 417 $ hg ci -Am adda
418 418 adding a
419 419 $ echo line1 > a
420 420 $ echo line2 >> a
421 421 $ echo line0 >> a
422 422 $ echo line3 >> a
423 423 $ hg ci -m change a
424 424 $ hg export tip > tip.patch
425 425 $ hg up -C 0
426 426 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
427 427 $ echo line1 > a
428 428 $ echo line0 >> a
429 429 $ echo line1 >> a
430 430 $ echo line0 >> a
431 431 $ hg ci -m brancha
432 432 created new head
433 433 $ hg import --no-commit -v tip.patch
434 434 applying tip.patch
435 435 patching file a
436 436 Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines).
437 437 $ hg revert -a
438 438 reverting a
439 439
440 440
441 441 import with --no-commit should have written .hg/last-message.txt
442 442
443 $ printf '\n' | cat .hg/last-message.txt -
444 change
443 $ cat .hg/last-message.txt
444 change (no-eol)
445 445
446 446
447 447 test fuzziness with eol=auto
448 448
449 449 $ hg --config patch.eol=auto import --no-commit -v tip.patch
450 450 applying tip.patch
451 451 patching file a
452 452 Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines).
453 453 $ cd ..
454 454
455 455
456 456 Test hunk touching empty files (issue906)
457 457
458 458 $ hg init empty
459 459 $ cd empty
460 460 $ touch a
461 461 $ touch b1
462 462 $ touch c1
463 463 $ echo d > d
464 464 $ hg ci -Am init
465 465 adding a
466 466 adding b1
467 467 adding c1
468 468 adding d
469 469 $ echo a > a
470 470 $ echo b > b1
471 471 $ hg mv b1 b2
472 472 $ echo c > c1
473 473 $ hg copy c1 c2
474 474 $ rm d
475 475 $ touch d
476 476 $ hg diff --git
477 477 diff --git a/a b/a
478 478 --- a/a
479 479 +++ b/a
480 480 @@ -0,0 +1,1 @@
481 481 +a
482 482 diff --git a/b1 b/b2
483 483 rename from b1
484 484 rename to b2
485 485 --- a/b1
486 486 +++ b/b2
487 487 @@ -0,0 +1,1 @@
488 488 +b
489 489 diff --git a/c1 b/c1
490 490 --- a/c1
491 491 +++ b/c1
492 492 @@ -0,0 +1,1 @@
493 493 +c
494 494 diff --git a/c1 b/c2
495 495 copy from c1
496 496 copy to c2
497 497 --- a/c1
498 498 +++ b/c2
499 499 @@ -0,0 +1,1 @@
500 500 +c
501 501 diff --git a/d b/d
502 502 --- a/d
503 503 +++ b/d
504 504 @@ -1,1 +0,0 @@
505 505 -d
506 506 $ hg ci -m empty
507 507 $ hg export --git tip > empty.diff
508 508 $ hg up -C 0
509 509 4 files updated, 0 files merged, 2 files removed, 0 files unresolved
510 510 $ hg import empty.diff
511 511 applying empty.diff
512 512 $ for name in a b1 b2 c1 c2 d; do
513 513 > echo % $name file
514 514 > test -f $name && cat $name
515 515 > done
516 516 % a file
517 517 a
518 518 % b1 file
519 519 % b2 file
520 520 b
521 521 % c1 file
522 522 c
523 523 % c2 file
524 524 c
525 525 % d file
526 526 $ cd ..
527 527
528 528
529 529 Test importing a patch ending with a binary file removal
530 530
531 531 $ hg init binaryremoval
532 532 $ cd binaryremoval
533 533 $ echo a > a
534 534 $ python -c "file('b', 'wb').write('a\x00b')"
535 535 $ hg ci -Am addall
536 536 adding a
537 537 adding b
538 538 $ hg rm a
539 539 $ hg rm b
540 540 $ hg st
541 541 R a
542 542 R b
543 543 $ hg ci -m remove
544 544 $ hg export --git . > remove.diff
545 545 $ cat remove.diff | grep git
546 546 diff --git a/a b/a
547 547 diff --git a/b b/b
548 548 $ hg up -C 0
549 549 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
550 550 $ hg import remove.diff
551 551 applying remove.diff
552 552 $ hg manifest
553 553 $ cd ..
554 554
555 555
556 556 Issue927: test update+rename with common name
557 557
558 558 $ hg init t
559 559 $ cd t
560 560 $ touch a
561 561 $ hg ci -Am t
562 562 adding a
563 563 $ echo a > a
564 564
565 565 Here, bfile.startswith(afile)
566 566
567 567 $ hg copy a a2
568 568 $ hg ci -m copya
569 569 $ hg export --git tip > copy.diff
570 570 $ hg up -C 0
571 571 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
572 572 $ hg import copy.diff
573 573 applying copy.diff
574 574
575 575 a should contain an 'a'
576 576
577 577 $ cat a
578 578 a
579 579
580 580 and a2 should have duplicated it
581 581
582 582 $ cat a2
583 583 a
584 584 $ cd ..
585 585
586 586
587 587 test -p0
588 588
589 589 $ hg init p0
590 590 $ cd p0
591 591 $ echo a > a
592 592 $ hg ci -Am t
593 593 adding a
594 594 $ hg import -p0 - << EOF
595 595 > foobar
596 596 > --- a Sat Apr 12 22:43:58 2008 -0400
597 597 > +++ a Sat Apr 12 22:44:05 2008 -0400
598 598 > @@ -1,1 +1,1 @@
599 599 > -a
600 600 > +bb
601 601 > EOF
602 602 applying patch from stdin
603 603 $ hg status
604 604 $ cat a
605 605 bb
606 606 $ cd ..
607 607
608 608
609 609 test paths outside repo root
610 610
611 611 $ mkdir outside
612 612 $ touch outside/foo
613 613 $ hg init inside
614 614 $ cd inside
615 615 $ hg import - <<EOF
616 616 > diff --git a/a b/b
617 617 > rename from ../outside/foo
618 618 > rename to bar
619 619 > EOF
620 620 applying patch from stdin
621 621 abort: ../outside/foo not under root
622 622 [255]
623 623 $ cd ..
624 624
625 625
626 626 test import with similarity and git and strip (issue295 et al.)
627 627
628 628 $ hg init sim
629 629 $ cd sim
630 630 $ echo 'this is a test' > a
631 631 $ hg ci -Ama
632 632 adding a
633 633 $ cat > ../rename.diff <<EOF
634 634 > diff --git a/foo/a b/foo/a
635 635 > deleted file mode 100644
636 636 > --- a/foo/a
637 637 > +++ /dev/null
638 638 > @@ -1,1 +0,0 @@
639 639 > -this is a test
640 640 > diff --git a/foo/b b/foo/b
641 641 > new file mode 100644
642 642 > --- /dev/null
643 643 > +++ b/foo/b
644 644 > @@ -0,0 +1,2 @@
645 645 > +this is a test
646 646 > +foo
647 647 > EOF
648 648 $ hg import --no-commit -v -s 1 ../rename.diff -p2
649 649 applying ../rename.diff
650 650 patching file a
651 651 patching file b
652 652 removing a
653 653 adding b
654 654 recording removal of a as rename to b (88% similar)
655 655 $ hg st -C
656 656 A b
657 657 a
658 658 R a
659 659 $ hg revert -a
660 660 undeleting a
661 661 forgetting b
662 662 $ rm b
663 663 $ hg import --no-commit -v -s 100 ../rename.diff -p2
664 664 applying ../rename.diff
665 665 patching file a
666 666 patching file b
667 667 removing a
668 668 adding b
669 669 $ hg st -C
670 670 A b
671 671 R a
672 672 $ cd ..
673 673
674 674
675 675 Issue1495: add empty file from the end of patch
676 676
677 677 $ hg init addemptyend
678 678 $ cd addemptyend
679 679 $ touch a
680 680 $ hg addremove
681 681 adding a
682 682 $ hg ci -m "commit"
683 683 $ cat > a.patch <<EOF
684 684 > diff --git a/a b/a
685 685 > --- a/a
686 686 > +++ b/a
687 687 > @@ -0,0 +1,1 @@
688 688 > +a
689 689 > diff --git a/b b/b
690 690 > new file mode 100644
691 691 > EOF
692 692 $ hg import --no-commit a.patch
693 693 applying a.patch
694 694 $ cd ..
695 695
696 696
697 697 create file when source is not /dev/null
698 698
699 699 $ cat > create.patch <<EOF
700 700 > diff -Naur proj-orig/foo proj-new/foo
701 701 > --- proj-orig/foo 1969-12-31 16:00:00.000000000 -0800
702 702 > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
703 703 > @@ -0,0 +1,1 @@
704 704 > +a
705 705 > EOF
706 706
707 707 some people have patches like the following too
708 708
709 709 $ cat > create2.patch <<EOF
710 710 > diff -Naur proj-orig/foo proj-new/foo
711 711 > --- proj-orig/foo.orig 1969-12-31 16:00:00.000000000 -0800
712 712 > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
713 713 > @@ -0,0 +1,1 @@
714 714 > +a
715 715 > EOF
716 716 $ hg init oddcreate
717 717 $ cd oddcreate
718 718 $ hg import --no-commit ../create.patch
719 719 applying ../create.patch
720 720 $ cat foo
721 721 a
722 722 $ rm foo
723 723 $ hg revert foo
724 724 $ hg import --no-commit ../create2.patch
725 725 applying ../create2.patch
726 726 $ cat foo
727 727 a
728 728
729 729
730 730 Issue1859: first line mistaken for email headers
731 731
732 732 $ hg init emailconfusion
733 733 $ cd emailconfusion
734 734 $ cat > a.patch <<EOF
735 735 > module: summary
736 736 >
737 737 > description
738 738 >
739 739 >
740 740 > diff -r 000000000000 -r 9b4c1e343b55 test.txt
741 741 > --- /dev/null
742 742 > +++ b/a
743 743 > @@ -0,0 +1,1 @@
744 744 > +a
745 745 > EOF
746 746 $ hg import -d '0 0' a.patch
747 747 applying a.patch
748 748 $ hg parents -v
749 749 changeset: 0:5a681217c0ad
750 750 tag: tip
751 751 user: test
752 752 date: Thu Jan 01 00:00:00 1970 +0000
753 753 files: a
754 754 description:
755 755 module: summary
756 756
757 757 description
758 758
759 759
760 760 $ cd ..
761 761
762 762
763 763 --- in commit message
764 764
765 765 $ hg init commitconfusion
766 766 $ cd commitconfusion
767 767 $ cat > a.patch <<EOF
768 768 > module: summary
769 769 >
770 770 > --- description
771 771 >
772 772 > diff --git a/a b/a
773 773 > new file mode 100644
774 774 > --- /dev/null
775 775 > +++ b/a
776 776 > @@ -0,0 +1,1 @@
777 777 > +a
778 778 > EOF
779 779 > hg import -d '0 0' a.patch
780 780 > hg parents -v
781 781 > cd ..
782 782 >
783 783 > echo '% tricky header splitting'
784 784 > cat > trickyheaders.patch <<EOF
785 785 > From: User A <user@a>
786 786 > Subject: [PATCH] from: tricky!
787 787 >
788 788 > # HG changeset patch
789 789 > # User User B
790 790 > # Date 1266264441 18000
791 791 > # Branch stable
792 792 > # Node ID f2be6a1170ac83bf31cb4ae0bad00d7678115bc0
793 793 > # Parent 0000000000000000000000000000000000000000
794 794 > from: tricky!
795 795 >
796 796 > That is not a header.
797 797 >
798 798 > diff -r 000000000000 -r f2be6a1170ac foo
799 799 > --- /dev/null
800 800 > +++ b/foo
801 801 > @@ -0,0 +1,1 @@
802 802 > +foo
803 803 > EOF
804 804 applying a.patch
805 805 changeset: 0:f34d9187897d
806 806 tag: tip
807 807 user: test
808 808 date: Thu Jan 01 00:00:00 1970 +0000
809 809 files: a
810 810 description:
811 811 module: summary
812 812
813 813
814 814 % tricky header splitting
815 815
816 816 $ hg init trickyheaders
817 817 $ cd trickyheaders
818 818 $ hg import -d '0 0' ../trickyheaders.patch
819 819 applying ../trickyheaders.patch
820 820 $ hg export --git tip
821 821 # HG changeset patch
822 822 # User User B
823 823 # Date 0 0
824 824 # Node ID eb56ab91903632294ac504838508cb370c0901d2
825 825 # Parent 0000000000000000000000000000000000000000
826 826 from: tricky!
827 827
828 828 That is not a header.
829 829
830 830 diff --git a/foo b/foo
831 831 new file mode 100644
832 832 --- /dev/null
833 833 +++ b/foo
834 834 @@ -0,0 +1,1 @@
835 835 +foo
836 836 $ cd ..
837 837
838 838
839 839 Issue2102: hg export and hg import speak different languages
840 840
841 841 $ hg init issue2102
842 842 $ cd issue2102
843 843 $ mkdir -p src/cmd/gc
844 844 $ touch src/cmd/gc/mksys.bash
845 845 $ hg ci -Am init
846 846 adding src/cmd/gc/mksys.bash
847 847 $ hg import - <<EOF
848 848 > # HG changeset patch
849 849 > # User Rob Pike
850 850 > # Date 1216685449 25200
851 851 > # Node ID 03aa2b206f499ad6eb50e6e207b9e710d6409c98
852 852 > # Parent 93d10138ad8df586827ca90b4ddb5033e21a3a84
853 853 > help management of empty pkg and lib directories in perforce
854 854 >
855 855 > R=gri
856 856 > DELTA=4 (4 added, 0 deleted, 0 changed)
857 857 > OCL=13328
858 858 > CL=13328
859 859 >
860 860 > diff --git a/lib/place-holder b/lib/place-holder
861 861 > new file mode 100644
862 862 > --- /dev/null
863 863 > +++ b/lib/place-holder
864 864 > @@ -0,0 +1,2 @@
865 865 > +perforce does not maintain empty directories.
866 866 > +this file helps.
867 867 > diff --git a/pkg/place-holder b/pkg/place-holder
868 868 > new file mode 100644
869 869 > --- /dev/null
870 870 > +++ b/pkg/place-holder
871 871 > @@ -0,0 +1,2 @@
872 872 > +perforce does not maintain empty directories.
873 873 > +this file helps.
874 874 > diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
875 875 > old mode 100644
876 876 > new mode 100755
877 877 > EOF
878 878 applying patch from stdin
879 879 $ hg sum
880 880 parent: 1:d59915696727 tip
881 881 help management of empty pkg and lib directories in perforce
882 882 branch: default
883 883 commit: (clean)
884 884 update: (current)
885 885 $ hg diff --git -c tip
886 886 diff --git a/lib/place-holder b/lib/place-holder
887 887 new file mode 100644
888 888 --- /dev/null
889 889 +++ b/lib/place-holder
890 890 @@ -0,0 +1,2 @@
891 891 +perforce does not maintain empty directories.
892 892 +this file helps.
893 893 diff --git a/pkg/place-holder b/pkg/place-holder
894 894 new file mode 100644
895 895 --- /dev/null
896 896 +++ b/pkg/place-holder
897 897 @@ -0,0 +1,2 @@
898 898 +perforce does not maintain empty directories.
899 899 +this file helps.
900 900 diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
901 901 old mode 100644
902 902 new mode 100755
903 903 $ cd ..
904 904
905 905
906 906 diff lines looking like headers
907 907
908 908 $ hg init difflineslikeheaders
909 909 $ cd difflineslikeheaders
910 910 $ echo a >a
911 911 $ echo b >b
912 912 $ echo c >c
913 913 $ hg ci -Am1
914 914 adding a
915 915 adding b
916 916 adding c
917 917
918 918 $ echo "key: value" >>a
919 919 $ echo "key: value" >>b
920 920 $ echo "foo" >>c
921 921 $ hg ci -m2
922 922
923 923 $ hg up -C 0
924 924 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
925 925 $ hg diff --git -c1 >want
926 926 $ hg diff -c1 | hg import --no-commit -
927 927 applying patch from stdin
928 928 $ hg diff --git >have
929 929 $ diff want have
930 930 $ cd ..
931 931
General Comments 0
You need to be logged in to leave comments. Login now