Mercurial > hg
diff mercurial/cmdutil.py @ 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 | 3a3adbcbd3a0 |
children | 5c7dbb730179 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Tue Oct 17 22:46:08 2017 +0200 +++ b/mercurial/cmdutil.py Wed Oct 18 19:00:33 2017 +0200 @@ -2652,6 +2652,9 @@ lineranges = fctxlineranges.get(fctx.path()) if lineranges is not None: for hr, lines in hunks: + if hr is None: # binary + yield hr, lines + continue if any(mdiff.hunkinrange(hr[2:], lr) for lr in lineranges): yield hr, lines