Mercurial > public > mercurial-scm > hg
diff mercurial/hgweb/webutil.py @ 31808:ca3b4a2b7e54
mdiff: add a hunkinrange helper function
This factors out hunk filtering logic by line range that is similar in
mdiff.blocksinrange() and hgweb.webutil.diffs().
author | Denis Laxalde <denis@laxalde.org> |
---|---|
date | Sat, 01 Apr 2017 12:24:59 +0200 |
parents | 6be6e4becaaf |
children | db63872e10cc |
line wrap: on
line diff
--- 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: