diff mercurial/hgweb/webcommands.py @ 31672:e540846c67e0

hgweb: filter diff hunks when 'linerange' and 'patch' are specified in filelog
author Denis Laxalde <denis.laxalde@logilab.fr>
date Mon, 13 Mar 2017 15:17:20 +0100
parents 5e6d44511317
children 6be6e4becaaf
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Mon Mar 13 15:15:49 2017 +0100
+++ b/mercurial/hgweb/webcommands.py	Mon Mar 13 15:17:20 2017 +0100
@@ -993,11 +993,12 @@
     if 'style' in req.form:
         diffstyle = req.form['style'][0]
 
-    def diff(fctx):
+    def diff(fctx, linerange=None):
         ctx = fctx.changectx()
         basectx = ctx.p1()
         path = fctx.path()
-        return webutil.diffs(web, tmpl, ctx, basectx, [path], diffstyle)
+        return webutil.diffs(web, tmpl, ctx, basectx, [path], diffstyle,
+                             linerange=linerange)
 
     linerange = None
     if lrange is not None:
@@ -1009,7 +1010,7 @@
         for i, (c, lr) in enumerate(ancestors, 1):
             diffs = None
             if patch:
-                diffs = diff(c)
+                diffs = diff(c, linerange=lr)
             # follow renames accross filtered (not in range) revisions
             path = c.path()
             entries.append(dict(