diff mercurial/hgweb/webutil.py @ 31704:cbe0bea82c79

hgweb: fix diff hunks filtering by line range in webutil.diffs() The previous clause for filter out a diff hunk was too restrictive. We need to consider the following cases (assuming linerange=(lb, ub) and the @s2,l2 hunkrange): <-(s2)--------(s2+l2)-> <-(lb)---(ub)-> <-(lb)---(ub)-> <-(lb)---(ub)-> previously on the first and last situations were considered. In test-hgweb-filelog.t, add a couple of lines at the beginning of file "b" so that the line range we will follow does not start at the beginning of file. This covers the change in aforementioned diff hunk filter clause.
author Denis Laxalde <denis.laxalde@logilab.fr>
date Wed, 29 Mar 2017 12:07:07 +0200
parents aaebc80c9f1d
children 6be6e4becaaf
line wrap: on
line diff
--- a/mercurial/hgweb/webutil.py	Sat Mar 25 11:30:08 2017 +0100
+++ b/mercurial/hgweb/webutil.py	Wed Mar 29 12:07:07 2017 +0200
@@ -473,7 +473,7 @@
             if linerange is not None and hunkrange is not None:
                 s1, l1, s2, l2 = hunkrange
                 lb, ub = linerange
-                if not (lb <= s2 < ub or lb < s2 + l2 <= ub):
+                if not (lb < s2 + l2 and ub > s2):
                     continue
             lines.extend(hunklines)
         if lines: