Debian Codegraph @

tests/test-log-linerange.t

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