##// END OF EJS Templates
tests: test "hg log" with --line-range and --copies...
Denis Laxalde -
r44030:d3c43680 default
parent child Browse files
Show More
@@ -1,922 +1,1028 b''
1 1 $ cat >> $HGRCPATH << EOF
2 2 > [diff]
3 3 > git = true
4 4 > EOF
5 5
6 6 $ hg init
7 7 $ cat > foo << EOF
8 8 > 0
9 9 > 1
10 10 > 2
11 11 > 3
12 12 > 4
13 13 > EOF
14 14 $ hg ci -Am init
15 15 adding foo
16 16 $ cat > foo << EOF
17 17 > 0
18 18 > 0
19 19 > 0
20 20 > 0
21 21 > 1
22 22 > 2
23 23 > 3
24 24 > 4
25 25 > EOF
26 26 $ hg ci -m 'more 0'
27 27 $ sed 's/2/2+/' foo > foo.new
28 28 $ mv foo.new foo
29 29 $ cat > bar << EOF
30 30 > a
31 31 > b
32 32 > c
33 33 > d
34 34 > e
35 35 > EOF
36 36 $ hg add bar
37 37 $ hg ci -Am "2 -> 2+; added bar"
38 38 $ cat >> foo << EOF
39 39 > 5
40 40 > 6
41 41 > 7
42 42 > 8
43 43 > 9
44 44 > 10
45 45 > 11
46 46 > EOF
47 47 $ hg ci -m "to 11"
48 48
49 49 Add some changes with two diff hunks
50 50
51 51 $ sed 's/^1$/ 1/' foo > foo.new
52 52 $ mv foo.new foo
53 53 $ sed 's/^11$/11+/' foo > foo.new
54 54 $ mv foo.new foo
55 55 $ hg ci -m '11 -> 11+; leading space before "1"'
56 56 (make sure there are two hunks in "foo")
57 57 $ hg diff -c .
58 58 diff --git a/foo b/foo
59 59 --- a/foo
60 60 +++ b/foo
61 61 @@ -2,7 +2,7 @@
62 62 0
63 63 0
64 64 0
65 65 -1
66 66 + 1
67 67 2+
68 68 3
69 69 4
70 70 @@ -12,4 +12,4 @@
71 71 8
72 72 9
73 73 10
74 74 -11
75 75 +11+
76 76 $ sed 's/3/3+/' foo > foo.new
77 77 $ mv foo.new foo
78 78 $ sed 's/^11+$/11-/' foo > foo.new
79 79 $ mv foo.new foo
80 80 $ sed 's/a/a+/' bar > bar.new
81 81 $ mv bar.new bar
82 82 $ hg ci -m 'foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+'
83 83 (make sure there are two hunks in "foo")
84 84 $ hg diff -c . foo
85 85 diff --git a/foo b/foo
86 86 --- a/foo
87 87 +++ b/foo
88 88 @@ -4,7 +4,7 @@
89 89 0
90 90 1
91 91 2+
92 92 -3
93 93 +3+
94 94 4
95 95 5
96 96 6
97 97 @@ -12,4 +12,4 @@
98 98 8
99 99 9
100 100 10
101 101 -11+
102 102 +11-
103 103
104 104 $ hg log -f -L foo,5:7 -p
105 105 changeset: 5:cfdf972b3971
106 106 tag: tip
107 107 user: test
108 108 date: Thu Jan 01 00:00:00 1970 +0000
109 109 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
110 110
111 111 diff --git a/foo b/foo
112 112 --- a/foo
113 113 +++ b/foo
114 114 @@ -4,7 +4,7 @@
115 115 0
116 116 1
117 117 2+
118 118 -3
119 119 +3+
120 120 4
121 121 5
122 122 6
123 123
124 124 changeset: 4:eaec41c1a0c9
125 125 user: test
126 126 date: Thu Jan 01 00:00:00 1970 +0000
127 127 summary: 11 -> 11+; leading space before "1"
128 128
129 129 diff --git a/foo b/foo
130 130 --- a/foo
131 131 +++ b/foo
132 132 @@ -2,7 +2,7 @@
133 133 0
134 134 0
135 135 0
136 136 -1
137 137 + 1
138 138 2+
139 139 3
140 140 4
141 141
142 142 changeset: 2:63a884426fd0
143 143 user: test
144 144 date: Thu Jan 01 00:00:00 1970 +0000
145 145 summary: 2 -> 2+; added bar
146 146
147 147 diff --git a/foo b/foo
148 148 --- a/foo
149 149 +++ b/foo
150 150 @@ -3,6 +3,6 @@
151 151 0
152 152 0
153 153 1
154 154 -2
155 155 +2+
156 156 3
157 157 4
158 158
159 159 changeset: 0:5ae1f82b9a00
160 160 user: test
161 161 date: Thu Jan 01 00:00:00 1970 +0000
162 162 summary: init
163 163
164 164 diff --git a/foo b/foo
165 165 new file mode 100644
166 166 --- /dev/null
167 167 +++ b/foo
168 168 @@ -0,0 +1,5 @@
169 169 +0
170 170 +1
171 171 +2
172 172 +3
173 173 +4
174 174
175 175 $ hg log -f --graph -L foo,5:7 -p
176 176 @ changeset: 5:cfdf972b3971
177 177 | tag: tip
178 178 | user: test
179 179 | date: Thu Jan 01 00:00:00 1970 +0000
180 180 | summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
181 181 |
182 182 | diff --git a/foo b/foo
183 183 | --- a/foo
184 184 | +++ b/foo
185 185 | @@ -4,7 +4,7 @@
186 186 | 0
187 187 | 1
188 188 | 2+
189 189 | -3
190 190 | +3+
191 191 | 4
192 192 | 5
193 193 | 6
194 194 |
195 195 o changeset: 4:eaec41c1a0c9
196 196 : user: test
197 197 : date: Thu Jan 01 00:00:00 1970 +0000
198 198 : summary: 11 -> 11+; leading space before "1"
199 199 :
200 200 : diff --git a/foo b/foo
201 201 : --- a/foo
202 202 : +++ b/foo
203 203 : @@ -2,7 +2,7 @@
204 204 : 0
205 205 : 0
206 206 : 0
207 207 : -1
208 208 : + 1
209 209 : 2+
210 210 : 3
211 211 : 4
212 212 :
213 213 o changeset: 2:63a884426fd0
214 214 : user: test
215 215 : date: Thu Jan 01 00:00:00 1970 +0000
216 216 : summary: 2 -> 2+; added bar
217 217 :
218 218 : diff --git a/foo b/foo
219 219 : --- a/foo
220 220 : +++ b/foo
221 221 : @@ -3,6 +3,6 @@
222 222 : 0
223 223 : 0
224 224 : 1
225 225 : -2
226 226 : +2+
227 227 : 3
228 228 : 4
229 229 :
230 230 o changeset: 0:5ae1f82b9a00
231 231 user: test
232 232 date: Thu Jan 01 00:00:00 1970 +0000
233 233 summary: init
234 234
235 235 diff --git a/foo b/foo
236 236 new file mode 100644
237 237 --- /dev/null
238 238 +++ b/foo
239 239 @@ -0,0 +1,5 @@
240 240 +0
241 241 +1
242 242 +2
243 243 +3
244 244 +4
245 245
246 246
247 247 With --template.
248 248
249 249 $ hg log -f -L foo,5:7 -T '{rev}:{node|short} {desc|firstline}\n'
250 250 5:cfdf972b3971 foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
251 251 4:eaec41c1a0c9 11 -> 11+; leading space before "1"
252 252 2:63a884426fd0 2 -> 2+; added bar
253 253 0:5ae1f82b9a00 init
254 254 $ hg log -f -L foo,5:7 -T json
255 255 [
256 256 {
257 257 "bookmarks": [],
258 258 "branch": "default",
259 259 "date": [0, 0],
260 260 "desc": "foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+",
261 261 "node": "cfdf972b3971a2a59638bf9583c0debbffee5404",
262 262 "parents": ["eaec41c1a0c9ad0a5e999611d0149d171beffb8c"],
263 263 "phase": "draft",
264 264 "rev": 5,
265 265 "tags": ["tip"],
266 266 "user": "test"
267 267 },
268 268 {
269 269 "bookmarks": [],
270 270 "branch": "default",
271 271 "date": [0, 0],
272 272 "desc": "11 -> 11+; leading space before \"1\"",
273 273 "node": "eaec41c1a0c9ad0a5e999611d0149d171beffb8c",
274 274 "parents": ["730a61fbaecf426c17c2c66bc42d195b5d5b0ba8"],
275 275 "phase": "draft",
276 276 "rev": 4,
277 277 "tags": [],
278 278 "user": "test"
279 279 },
280 280 {
281 281 "bookmarks": [],
282 282 "branch": "default",
283 283 "date": [0, 0],
284 284 "desc": "2 -> 2+; added bar",
285 285 "node": "63a884426fd0b277fcd55895bbb2f230434576eb",
286 286 "parents": ["29a1e7c6b80024f63f310a2d71de979e9d2996d7"],
287 287 "phase": "draft",
288 288 "rev": 2,
289 289 "tags": [],
290 290 "user": "test"
291 291 },
292 292 {
293 293 "bookmarks": [],
294 294 "branch": "default",
295 295 "date": [0, 0],
296 296 "desc": "init",
297 297 "node": "5ae1f82b9a000ff1e0967d0dac1c58b9d796e1b4",
298 298 "parents": ["0000000000000000000000000000000000000000"],
299 299 "phase": "draft",
300 300 "rev": 0,
301 301 "tags": [],
302 302 "user": "test"
303 303 }
304 304 ]
305 305
306 306 With some white-space diff option, respective revisions are skipped.
307 307
308 308 $ hg log -f -L foo,5:7 -p --config diff.ignorews=true
309 309 changeset: 5:cfdf972b3971
310 310 tag: tip
311 311 user: test
312 312 date: Thu Jan 01 00:00:00 1970 +0000
313 313 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
314 314
315 315 diff --git a/foo b/foo
316 316 --- a/foo
317 317 +++ b/foo
318 318 @@ -4,7 +4,7 @@
319 319 0
320 320 1
321 321 2+
322 322 -3
323 323 +3+
324 324 4
325 325 5
326 326 6
327 327
328 328 changeset: 2:63a884426fd0
329 329 user: test
330 330 date: Thu Jan 01 00:00:00 1970 +0000
331 331 summary: 2 -> 2+; added bar
332 332
333 333 diff --git a/foo b/foo
334 334 --- a/foo
335 335 +++ b/foo
336 336 @@ -3,6 +3,6 @@
337 337 0
338 338 0
339 339 1
340 340 -2
341 341 +2+
342 342 3
343 343 4
344 344
345 345 changeset: 0:5ae1f82b9a00
346 346 user: test
347 347 date: Thu Jan 01 00:00:00 1970 +0000
348 348 summary: init
349 349
350 350 diff --git a/foo b/foo
351 351 new file mode 100644
352 352 --- /dev/null
353 353 +++ b/foo
354 354 @@ -0,0 +1,5 @@
355 355 +0
356 356 +1
357 357 +2
358 358 +3
359 359 +4
360 360
361 361
362 362 Regular file patterns are not allowed.
363 363
364 364 $ hg log -f -L foo,5:7 -p bar
365 365 abort: FILE arguments are not compatible with --line-range option
366 366 [255]
367 367
368 368 Option --rev acts as a restriction.
369 369
370 370 $ hg log -f -L foo,5:7 -p -r 'desc(2)'
371 371 changeset: 2:63a884426fd0
372 372 user: test
373 373 date: Thu Jan 01 00:00:00 1970 +0000
374 374 summary: 2 -> 2+; added bar
375 375
376 376 diff --git a/foo b/foo
377 377 --- a/foo
378 378 +++ b/foo
379 379 @@ -3,6 +3,6 @@
380 380 0
381 381 0
382 382 1
383 383 -2
384 384 +2+
385 385 3
386 386 4
387 387
388 388 changeset: 0:5ae1f82b9a00
389 389 user: test
390 390 date: Thu Jan 01 00:00:00 1970 +0000
391 391 summary: init
392 392
393 393 diff --git a/foo b/foo
394 394 new file mode 100644
395 395 --- /dev/null
396 396 +++ b/foo
397 397 @@ -0,0 +1,5 @@
398 398 +0
399 399 +1
400 400 +2
401 401 +3
402 402 +4
403 403
404 404
405 405 With several -L patterns, changes touching any files in their respective line
406 406 range are show.
407 407
408 408 $ hg log -f -L foo,5:7 -L bar,1:2 -p
409 409 changeset: 5:cfdf972b3971
410 410 tag: tip
411 411 user: test
412 412 date: Thu Jan 01 00:00:00 1970 +0000
413 413 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
414 414
415 415 diff --git a/bar b/bar
416 416 --- a/bar
417 417 +++ b/bar
418 418 @@ -1,4 +1,4 @@
419 419 -a
420 420 +a+
421 421 b
422 422 c
423 423 d
424 424 diff --git a/foo b/foo
425 425 --- a/foo
426 426 +++ b/foo
427 427 @@ -4,7 +4,7 @@
428 428 0
429 429 1
430 430 2+
431 431 -3
432 432 +3+
433 433 4
434 434 5
435 435 6
436 436
437 437 changeset: 4:eaec41c1a0c9
438 438 user: test
439 439 date: Thu Jan 01 00:00:00 1970 +0000
440 440 summary: 11 -> 11+; leading space before "1"
441 441
442 442 diff --git a/foo b/foo
443 443 --- a/foo
444 444 +++ b/foo
445 445 @@ -2,7 +2,7 @@
446 446 0
447 447 0
448 448 0
449 449 -1
450 450 + 1
451 451 2+
452 452 3
453 453 4
454 454
455 455 changeset: 2:63a884426fd0
456 456 user: test
457 457 date: Thu Jan 01 00:00:00 1970 +0000
458 458 summary: 2 -> 2+; added bar
459 459
460 460 diff --git a/bar b/bar
461 461 new file mode 100644
462 462 --- /dev/null
463 463 +++ b/bar
464 464 @@ -0,0 +1,5 @@
465 465 +a
466 466 +b
467 467 +c
468 468 +d
469 469 +e
470 470 diff --git a/foo b/foo
471 471 --- a/foo
472 472 +++ b/foo
473 473 @@ -3,6 +3,6 @@
474 474 0
475 475 0
476 476 1
477 477 -2
478 478 +2+
479 479 3
480 480 4
481 481
482 482 changeset: 0:5ae1f82b9a00
483 483 user: test
484 484 date: Thu Jan 01 00:00:00 1970 +0000
485 485 summary: init
486 486
487 487 diff --git a/foo b/foo
488 488 new file mode 100644
489 489 --- /dev/null
490 490 +++ b/foo
491 491 @@ -0,0 +1,5 @@
492 492 +0
493 493 +1
494 494 +2
495 495 +3
496 496 +4
497 497
498 498
499 499 Multiple -L options with the same file yields changes touching any of
500 500 specified line ranges.
501 501
502 502 $ hg log -f -L foo,5:7 -L foo,14:15 -p
503 503 changeset: 5:cfdf972b3971
504 504 tag: tip
505 505 user: test
506 506 date: Thu Jan 01 00:00:00 1970 +0000
507 507 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
508 508
509 509 diff --git a/foo b/foo
510 510 --- a/foo
511 511 +++ b/foo
512 512 @@ -4,7 +4,7 @@
513 513 0
514 514 1
515 515 2+
516 516 -3
517 517 +3+
518 518 4
519 519 5
520 520 6
521 521 @@ -12,4 +12,4 @@
522 522 8
523 523 9
524 524 10
525 525 -11+
526 526 +11-
527 527
528 528 changeset: 4:eaec41c1a0c9
529 529 user: test
530 530 date: Thu Jan 01 00:00:00 1970 +0000
531 531 summary: 11 -> 11+; leading space before "1"
532 532
533 533 diff --git a/foo b/foo
534 534 --- a/foo
535 535 +++ b/foo
536 536 @@ -2,7 +2,7 @@
537 537 0
538 538 0
539 539 0
540 540 -1
541 541 + 1
542 542 2+
543 543 3
544 544 4
545 545 @@ -12,4 +12,4 @@
546 546 8
547 547 9
548 548 10
549 549 -11
550 550 +11+
551 551
552 552 changeset: 3:730a61fbaecf
553 553 user: test
554 554 date: Thu Jan 01 00:00:00 1970 +0000
555 555 summary: to 11
556 556
557 557 diff --git a/foo b/foo
558 558 --- a/foo
559 559 +++ b/foo
560 560 @@ -6,3 +6,10 @@
561 561 2+
562 562 3
563 563 4
564 564 +5
565 565 +6
566 566 +7
567 567 +8
568 568 +9
569 569 +10
570 570 +11
571 571
572 572 changeset: 2:63a884426fd0
573 573 user: test
574 574 date: Thu Jan 01 00:00:00 1970 +0000
575 575 summary: 2 -> 2+; added bar
576 576
577 577 diff --git a/foo b/foo
578 578 --- a/foo
579 579 +++ b/foo
580 580 @@ -3,6 +3,6 @@
581 581 0
582 582 0
583 583 1
584 584 -2
585 585 +2+
586 586 3
587 587 4
588 588
589 589 changeset: 0:5ae1f82b9a00
590 590 user: test
591 591 date: Thu Jan 01 00:00:00 1970 +0000
592 592 summary: init
593 593
594 594 diff --git a/foo b/foo
595 595 new file mode 100644
596 596 --- /dev/null
597 597 +++ b/foo
598 598 @@ -0,0 +1,5 @@
599 599 +0
600 600 +1
601 601 +2
602 602 +3
603 603 +4
604 604
605 605
606 606 A file with a comma in its name.
607 607
608 608 $ cat > ba,z << EOF
609 609 > q
610 610 > w
611 611 > e
612 612 > r
613 613 > t
614 614 > y
615 615 > EOF
616 616 $ hg ci -Am 'querty'
617 617 adding ba,z
618 618 $ cat >> ba,z << EOF
619 619 > u
620 620 > i
621 621 > o
622 622 > p
623 623 > EOF
624 624 $ hg ci -m 'more keys'
625 625 $ cat > ba,z << EOF
626 626 > a
627 627 > z
628 628 > e
629 629 > r
630 630 > t
631 631 > y
632 632 > u
633 633 > i
634 634 > o
635 635 > p
636 636 > EOF
637 637 $ hg ci -m 'azerty'
638 638 $ hg log -f -L ba,z,1:2 -p
639 639 changeset: 8:52373265138b
640 640 tag: tip
641 641 user: test
642 642 date: Thu Jan 01 00:00:00 1970 +0000
643 643 summary: azerty
644 644
645 645 diff --git a/ba,z b/ba,z
646 646 --- a/ba,z
647 647 +++ b/ba,z
648 648 @@ -1,5 +1,5 @@
649 649 -q
650 650 -w
651 651 +a
652 652 +z
653 653 e
654 654 r
655 655 t
656 656
657 657 changeset: 6:96ba8850f316
658 658 user: test
659 659 date: Thu Jan 01 00:00:00 1970 +0000
660 660 summary: querty
661 661
662 662 diff --git a/ba,z b/ba,z
663 663 new file mode 100644
664 664 --- /dev/null
665 665 +++ b/ba,z
666 666 @@ -0,0 +1,6 @@
667 667 +q
668 668 +w
669 669 +e
670 670 +r
671 671 +t
672 672 +y
673 673
674 674
675 675 Exact prefix kinds work in -L options.
676 676
677 677 $ mkdir dir
678 678 $ cd dir
679 679 $ hg log -f -L path:foo,5:7 -p
680 680 changeset: 5:cfdf972b3971
681 681 user: test
682 682 date: Thu Jan 01 00:00:00 1970 +0000
683 683 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
684 684
685 685 diff --git a/foo b/foo
686 686 --- a/foo
687 687 +++ b/foo
688 688 @@ -4,7 +4,7 @@
689 689 0
690 690 1
691 691 2+
692 692 -3
693 693 +3+
694 694 4
695 695 5
696 696 6
697 697
698 698 changeset: 4:eaec41c1a0c9
699 699 user: test
700 700 date: Thu Jan 01 00:00:00 1970 +0000
701 701 summary: 11 -> 11+; leading space before "1"
702 702
703 703 diff --git a/foo b/foo
704 704 --- a/foo
705 705 +++ b/foo
706 706 @@ -2,7 +2,7 @@
707 707 0
708 708 0
709 709 0
710 710 -1
711 711 + 1
712 712 2+
713 713 3
714 714 4
715 715
716 716 changeset: 2:63a884426fd0
717 717 user: test
718 718 date: Thu Jan 01 00:00:00 1970 +0000
719 719 summary: 2 -> 2+; added bar
720 720
721 721 diff --git a/foo b/foo
722 722 --- a/foo
723 723 +++ b/foo
724 724 @@ -3,6 +3,6 @@
725 725 0
726 726 0
727 727 1
728 728 -2
729 729 +2+
730 730 3
731 731 4
732 732
733 733 changeset: 0:5ae1f82b9a00
734 734 user: test
735 735 date: Thu Jan 01 00:00:00 1970 +0000
736 736 summary: init
737 737
738 738 diff --git a/foo b/foo
739 739 new file mode 100644
740 740 --- /dev/null
741 741 +++ b/foo
742 742 @@ -0,0 +1,5 @@
743 743 +0
744 744 +1
745 745 +2
746 746 +3
747 747 +4
748 748
749 749
750 750 Renames are followed.
751 751
752 752 $ hg mv ../foo baz
753 753 $ sed 's/1/1+/' baz > baz.new
754 754 $ mv baz.new baz
755 755 $ hg ci -m 'foo -> dir/baz; 1-1+'
756 756 $ hg diff -c .
757 757 diff --git a/foo b/dir/baz
758 758 rename from foo
759 759 rename to dir/baz
760 760 --- a/foo
761 761 +++ b/dir/baz
762 762 @@ -2,7 +2,7 @@
763 763 0
764 764 0
765 765 0
766 766 - 1
767 767 + 1+
768 768 2+
769 769 3+
770 770 4
771 771 @@ -11,5 +11,5 @@
772 772 7
773 773 8
774 774 9
775 775 -10
776 776 -11-
777 777 +1+0
778 778 +1+1-
779 779 $ hg log -f -L relpath:baz,5:7 -p
780 780 changeset: 9:6af29c3a778f
781 781 tag: tip
782 782 user: test
783 783 date: Thu Jan 01 00:00:00 1970 +0000
784 784 summary: foo -> dir/baz; 1-1+
785 785
786 786 diff --git a/foo b/dir/baz
787 787 copy from foo
788 788 copy to dir/baz
789 789 --- a/foo
790 790 +++ b/dir/baz
791 791 @@ -2,7 +2,7 @@
792 792 0
793 793 0
794 794 0
795 795 - 1
796 796 + 1+
797 797 2+
798 798 3+
799 799 4
800 800
801 801 changeset: 5:cfdf972b3971
802 802 user: test
803 803 date: Thu Jan 01 00:00:00 1970 +0000
804 804 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
805 805
806 806 diff --git a/foo b/foo
807 807 --- a/foo
808 808 +++ b/foo
809 809 @@ -4,7 +4,7 @@
810 810 0
811 811 1
812 812 2+
813 813 -3
814 814 +3+
815 815 4
816 816 5
817 817 6
818 818
819 819 changeset: 4:eaec41c1a0c9
820 820 user: test
821 821 date: Thu Jan 01 00:00:00 1970 +0000
822 822 summary: 11 -> 11+; leading space before "1"
823 823
824 824 diff --git a/foo b/foo
825 825 --- a/foo
826 826 +++ b/foo
827 827 @@ -2,7 +2,7 @@
828 828 0
829 829 0
830 830 0
831 831 -1
832 832 + 1
833 833 2+
834 834 3
835 835 4
836 836
837 837 changeset: 2:63a884426fd0
838 838 user: test
839 839 date: Thu Jan 01 00:00:00 1970 +0000
840 840 summary: 2 -> 2+; added bar
841 841
842 842 diff --git a/foo b/foo
843 843 --- a/foo
844 844 +++ b/foo
845 845 @@ -3,6 +3,6 @@
846 846 0
847 847 0
848 848 1
849 849 -2
850 850 +2+
851 851 3
852 852 4
853 853
854 854 changeset: 0:5ae1f82b9a00
855 855 user: test
856 856 date: Thu Jan 01 00:00:00 1970 +0000
857 857 summary: init
858 858
859 859 diff --git a/foo b/foo
860 860 new file mode 100644
861 861 --- /dev/null
862 862 +++ b/foo
863 863 @@ -0,0 +1,5 @@
864 864 +0
865 865 +1
866 866 +2
867 867 +3
868 868 +4
869 869
870 870
871 Copies.
872
873 $ hg copy baz bbaz
874 $ sed 's/6/6+/' bbaz > bbaz.new
875 $ mv bbaz.new bbaz
876 $ hg commit -m 'cp baz bbaz; 6-6+'
877 $ hg diff -c .
878 diff --git a/dir/baz b/dir/bbaz
879 copy from dir/baz
880 copy to dir/bbaz
881 --- a/dir/baz
882 +++ b/dir/bbaz
883 @@ -7,7 +7,7 @@
884 3+
885 4
886 5
887 -6
888 +6+
889 7
890 8
891 9
892 $ hg log --copies -f -L bbaz,10:11 -p
893 changeset: 10:91a3d3b6c546
894 tag: tip
895 user: test
896 date: Thu Jan 01 00:00:00 1970 +0000
897 summary: cp baz bbaz; 6-6+
898
899 diff --git a/dir/baz b/dir/bbaz
900 copy from dir/baz
901 copy to dir/bbaz
902 --- a/dir/baz
903 +++ b/dir/bbaz
904 @@ -7,7 +7,7 @@
905 3+
906 4
907 5
908 -6
909 +6+
910 7
911 8
912 9
913
914 changeset: 3:730a61fbaecf
915 user: test
916 date: Thu Jan 01 00:00:00 1970 +0000
917 summary: to 11
918
919 diff --git a/foo b/foo
920 --- a/foo
921 +++ b/foo
922 @@ -6,3 +6,10 @@
923 2+
924 3
925 4
926 +5
927 +6
928 +7
929 +8
930 +9
931 +10
932 +11
933
934 $ hg log -f -L bbaz,10:11 -p
935 changeset: 10:91a3d3b6c546
936 tag: tip
937 user: test
938 date: Thu Jan 01 00:00:00 1970 +0000
939 summary: cp baz bbaz; 6-6+
940
941 diff --git a/dir/baz b/dir/bbaz
942 copy from dir/baz
943 copy to dir/bbaz
944 --- a/dir/baz
945 +++ b/dir/bbaz
946 @@ -7,7 +7,7 @@
947 3+
948 4
949 5
950 -6
951 +6+
952 7
953 8
954 9
955
956 changeset: 3:730a61fbaecf
957 user: test
958 date: Thu Jan 01 00:00:00 1970 +0000
959 summary: to 11
960
961 diff --git a/foo b/foo
962 --- a/foo
963 +++ b/foo
964 @@ -6,3 +6,10 @@
965 2+
966 3
967 4
968 +5
969 +6
970 +7
971 +8
972 +9
973 +10
974 +11
975
976
871 977 Binary files work but without diff hunks filtering.
872 978 (Checking w/ and w/o diff.git option.)
873 979
874 980 >>> open('binary', 'wb').write(b'this\nis\na\nbinary\0') and None
875 981 $ hg add binary
876 982 $ hg ci -m 'add a binary file' --quiet
877 983 $ hg log -f -L binary,1:2 -p
878 changeset: 10:c96381c229df
984 changeset: 11:dc865b608edf
879 985 tag: tip
880 986 user: test
881 987 date: Thu Jan 01 00:00:00 1970 +0000
882 988 summary: add a binary file
883 989
884 990 diff --git a/dir/binary b/dir/binary
885 991 new file mode 100644
886 992 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..c2e1fbed209fe919b3f189a6a31950e9adf61e45
887 993 GIT binary patch
888 994 literal 17
889 995 Wc$_QA$SmdpqC~Ew%)G>+N(KNlNClYy
890 996
891 997
892 998 $ hg log -f -L binary,1:2 -p --config diff.git=false
893 changeset: 10:c96381c229df
999 changeset: 11:dc865b608edf
894 1000 tag: tip
895 1001 user: test
896 1002 date: Thu Jan 01 00:00:00 1970 +0000
897 1003 summary: add a binary file
898 1004
899 diff -r 6af29c3a778f -r c96381c229df dir/binary
1005 diff -r 91a3d3b6c546 -r dc865b608edf dir/binary
900 1006 Binary file dir/binary has changed
901 1007
902 1008
903 1009 Option --follow is required.
904 1010
905 1011 $ hg log -L foo,5:7
906 1012 abort: --line-range requires --follow
907 1013 [255]
908 1014
909 1015 Non-exact pattern kinds are not allowed.
910 1016
911 1017 $ cd ..
912 1018 $ hg log -f -L glob:*a*,1:2
913 1019 hg: parse error: line range pattern 'glob:*a*' must match exactly one file
914 1020 [255]
915 1021
916 1022 We get an error for removed files.
917 1023
918 1024 $ hg rm dir/baz
919 1025 $ hg ci -m 'remove baz' --quiet
920 1026 $ hg log -f -L dir/baz,5:7 -p
921 1027 abort: cannot follow file not in parent revision: "dir/baz"
922 1028 [255]
General Comments 0
You need to be logged in to leave comments. Login now