webutil: pass a diffopts object to context.diff
authorBoris Feld <boris.feld@octobus.net>
Sat, 23 Jun 2018 14:42:58 +0200
changeset 38566 1770416de208
parent 38565 6ec996e8c9bc
child 38567 97469c5430cd
webutil: pass a diffopts object to context.diff
mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py	Sat Jun 23 14:37:10 2018 +0200
+++ b/mercurial/hgweb/webutil.py	Sat Jun 23 14:42:58 2018 +0200
@@ -41,6 +41,7 @@
 )
 
 from ..utils import (
+    diffutil,
     stringutil,
 )
 
@@ -206,8 +207,8 @@
     return templateutil.mappinggenerator(_ctxsgen, args=(siblings,))
 
 def difffeatureopts(req, ui, section):
-    diffopts = patch.difffeatureopts(ui, untrusted=True,
-                                     section=section, whitespace=True)
+    diffopts = diffutil.difffeatureopts(ui, untrusted=True,
+                                        section=section, whitespace=True)
 
     for k in ('ignorews', 'ignorewsamount', 'ignorewseol', 'ignoreblanklines'):
         v = req.qsparams.get(k)
@@ -657,8 +658,9 @@
 def diffstatgen(ctx, basectx):
     '''Generator function that provides the diffstat data.'''
 
+    diffopts = patch.diffopts(ctx._repo.ui, {'noprefix': False})
     stats = patch.diffstatdata(
-        util.iterlines(ctx.diff(basectx, opts={'noprefix': False})))
+        util.iterlines(ctx.diff(basectx, opts=diffopts)))
     maxname, maxtotal, addtotal, removetotal, binary = patch.diffstatsum(stats)
     while True:
         yield stats, maxname, maxtotal, addtotal, removetotal, binary