Mercurial > hg
comparison tests/test-log-linerange.t @ 34904:4554649a6ea4
log: handle binary files in --line-range patterns
When a file is binary patch.trydiff() would yield None for 'hunkrange'. Handle
this case in the hunksfilter() callback.
Add tests with and without diff.git option as binary handling differs
depending on this option's value.
author | Denis Laxalde <denis@laxalde.org> |
---|---|
date | Wed, 18 Oct 2017 19:00:33 +0200 |
parents | 84c6b9384d6a |
children | 5c7dbb730179 |
comparison
equal
deleted
inserted
replaced
34903:16d9f0b3e134 | 34904:4554649a6ea4 |
---|---|
847 +1 | 847 +1 |
848 +2 | 848 +2 |
849 +3 | 849 +3 |
850 +4 | 850 +4 |
851 | 851 |
852 | |
853 Binary files work but without diff hunks filtering. | |
854 (Checking w/ and w/o diff.git option.) | |
855 | |
856 >>> open('binary', 'w').write('this\nis\na\nbinary\0') | |
857 $ hg add binary | |
858 $ hg ci -m 'add a binary file' --quiet | |
859 $ hg log -f -L binary,1-2 -p | |
860 changeset: 10:c96381c229df | |
861 tag: tip | |
862 user: test | |
863 date: Thu Jan 01 00:00:00 1970 +0000 | |
864 summary: add a binary file | |
865 | |
866 diff --git a/dir/binary b/dir/binary | |
867 new file mode 100644 | |
868 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..c2e1fbed209fe919b3f189a6a31950e9adf61e45 | |
869 GIT binary patch | |
870 literal 17 | |
871 Wc$_QA$SmdpqC~Ew%)G>+N(KNlNClYy | |
872 | |
873 | |
874 $ hg log -f -L binary,1-2 -p --config diff.git=false | |
875 changeset: 10:c96381c229df | |
876 tag: tip | |
877 user: test | |
878 date: Thu Jan 01 00:00:00 1970 +0000 | |
879 summary: add a binary file | |
880 | |
881 diff -r 6af29c3a778f -r c96381c229df dir/binary | |
882 Binary file dir/binary has changed | |
883 | |
884 | |
852 Option --follow is required. | 885 Option --follow is required. |
853 | 886 |
854 $ hg log -L foo,5-7 | 887 $ hg log -L foo,5-7 |
855 abort: --line-range requires --follow | 888 abort: --line-range requires --follow |
856 [255] | 889 [255] |