diff -r e6eb86b154c5 -r ca3b4a2b7e54 mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py Fri Apr 22 21:46:33 2016 +0900 +++ b/mercurial/hgweb/webutil.py Sat Apr 01 12:24:59 2017 +0200 @@ -27,6 +27,7 @@ context, error, match, + mdiff, patch, pathutil, templatefilters, @@ -473,8 +474,7 @@ for hunkrange, hunklines in hunks: if linerange is not None and hunkrange is not None: s1, l1, s2, l2 = hunkrange - lb, ub = linerange - if not (lb < s2 + l2 and ub > s2): + if not mdiff.hunkinrange((s2, l2), linerange): continue lines.extend(hunklines) if lines: